RFR (jdk10): JDK-8180175: ObjectSynchronizer only needs to iterate in-use monitors

Robbin Ehn robbin.ehn at oracle.com
Thu May 18 09:33:38 UTC 2017


> 
> Not sure it makes any practical difference. If you do it before then the thread is still part of safepoint protocol, so no safepoint can occur while calling omFlush. If you 
> do it while holding Threads_lock then no safepoint can occur while doing omFlush.

New people to the code would assume there is a point doing it under the lock.
I think the code also would a bit nicer doing it outside and as you said:
"critical sections should be as short as possible"

Since Threads_lock is used e.g. every-time we loop the threads list, so that point is still totally valid.

/Robbin

> 
> David
> 


More information about the hotspot-runtime-dev mailing list