
Thanks Vibhu! However, although related, I don't see how your answer answered my question. (Or, perhaps it does but I don't get it.) I'm not really asking about how Java threads work or the fact that all Java programs (including ABCL) work with threads (although they may not be thread-safe). I already understand that. I'm asking: A. If I can accomplish what I desire using the regular Java and ABCL APIs. B. How? Thanks! Blake On Thu, Sep 19, 2024 at 8:04 AM Vibhu Mohindra <vibhu.mohindra@gmail.com> wrote:
Yes, ABCL threads are Java threads underneath.
Store the per-thread data in a java.lang.ThreadLocal variable, then it will be garbage collected when the thread ends. (If Thread A may want to access Thread B's per-thread data, then that'll need more thought.)
The bordeaux-threads library's MAKE-LOCK creates a Java ReentrantLock. Follow the usual rules for portably and correctly accessing data from multiple threads. https://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html
Vibhu