RFR: 8356173: Remove ThreadCritical [v3]

Coleen Phillimore coleenp at openjdk.org
Fri May 9 22:13:39 UTC 2025


On Fri, 9 May 2025 20:52:19 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> I didn't know this about Windows.  The Windows code seemed fine with the static PlatformMutex.  The posix code calls pthread_mutex_init with an parameter that's initialized in os::init() -> pthread_init_common();
>> 
>> If I call pthread_init_common() in all the places that  _mutexAttr and condAttr are used, the macosx platform is happier.  And I can make PlatformMutex static and remove that initialize_chunk_pool() function.  I don't think this is a nice change though.
>
> For Windows, a static PlatformMutex introduces a global variable with a non-trivial constructor,
> which we avoid because of ye old "static initialization order fiasco".  I don't think we should
> make this PlatformMutex statically allocated.  We should retain initialize_chunk_pool().
> (Especially because the lock-free chunk-pool idea that @jdksjolen  and I have discussed likely
> wants an initialization function.)

Good.  initialize_chunk_pool() is called at the right place after os::init which for posix anyways initializes global variables that pthread_mutex_init needs.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25072#discussion_r2082559537


More information about the hotspot-dev mailing list