How to run specific part of the SerialGC in a new thread?

Thomas Schatzl thomas.schatzl at oracle.com
Mon Aug 3 09:21:56 UTC 2020


Hi,

On 30.07.20 09:07, Ofir Gordon wrote:
> Hi,
> 
> It's a very late followup but I just got to work on it.
> Thanks for the code example, it seems to work.
> Is there a way to get the current thread's id, before activating the 
> worker and after activating it? Again, the normal cpp way using 

You mean the OS id? Thread contains an OSThread data structure that 
contains that info. Something like 
Thread::current()->os_thread()->thread_id(). Otherwise please dig into 
OSThread if it contains something useful for you.

> std::this_thread::get_id() is not compiling (I can't seem to include 
> <thread> in the project..)
> Also, is there a way to wait on a worker until it finishes? or does it 
> happen automatically since it initializes a "not concurrent" thread?

The call to run_task() automatically waits until all workers finish.

Thanks,
   Thomas


More information about the hotspot-gc-dev mailing list