回复: 回复: 回复: Avoid Native Pin when use Continuation direclty with reflection invoke(Internet mail)
kalinshi(施慧)
kalinshi at tencent.com
Thu Nov 12 10:55:28 UTC 2020
Thank! I checked early discussion and the situation is quite same with us.
There are JLA.getCarrierThreadLocal/setCarrierThreadLocal interfaces. They can be access with --add-exports options and access carrier thread’s thread locals..
Will loom keep these interfaces?
Regards
Hui
发件人: Alan Bateman <Alan.Bateman at oracle.com>
发送时间: 2020年11月12日 5:00
收件人: kalinshi(施慧) <kalinshi at tencent.com>; loom-dev at openjdk.java.net
主题: Re: 回复: 回复: Avoid Native Pin when use Continuation direclty with reflection invoke(Internet mail)
On 11/11/2020 14:14, kalinshi(施慧) wrote:
> As for your need to declare data to be local (with ThreadLocal) and then share it globally, can you explain what it is that you’re trying to do?
For ThreadLocal on carrier thread, we want all VirtualThreads running on it can access and update this carrier thread’s ThreadLocal.
This carrier ThreadLocal can hold shared configurations/stats/resources used by all VirtualThreads running on same carrier thread.
It’s not suppose “share it globally,” share it between all VirtualThreads on same carrier thread.
We don't want to expose access to the carrier thread's locals as it could lead to all manner of breakage. There are number of discussion on this topic already in the mail archive,
If you use a custom scheduler, as Ron suggested, then you get a "hook" to run code on the carrier thread before and after the virtual thread task. The hook has a reference to the virtual thread so you may have enough for what you are doing.
-Alan
More information about the loom-dev
mailing list