Concurrent Truffle languages and creating threads

Boris Spasojevic boris.spasojevic at oracle.com
Fri Sep 29 10:02:31 UTC 2017


Hey Arthur,

Not sure about the details of your use case, but AFAIK subclassing 
Thread should be avoided in Java, so maybe investing in the refactoring 
might be worth while.

When you say that you use a thread pool, do you mean you use a 
ThreadPoolExecutor? If so, I guess you could use a ThreadFactory to it 
which wraps TruffleLanguage.Env.createThread.

Cheers,
BoriS


On 09/28/2017 05:48 PM, Arthur Peters wrote:
> I am implementing a language (Orc) which uses a thread pool for
> execution (meaning any program running in this language will always use
> the thread pool). The change log for GraalVM 0.28 says that creating
> threads using j.l.Thread is deprecated.
>
> Does this mean that my thread pool should use
> TruffleLanguage.Env.createThread?
>
> Or is createThread only required for specific cases?
>
> (Currently I use a Thread subclass for the worker threads in my thread
> pool, so switching to createThread would require significant refactoring.)
>
> -Arthur
>
>



More information about the graal-dev mailing list