# HG changeset patch # User stuefe # Date 1499956094 -7200 # Node ID d33b4d593f9b08fe0aaa061f86ebc11185931ce8 # Parent 9843d494abd51355525233c35ca0036b17fcc26e 8184339: Thread::current_or_null() shall not assert if Posix TLS is not yet initialized Reviewed-by: dcubed, coleenp diff -r 9843d494abd5 -r d33b4d593f9b hotspot/src/share/vm/runtime/thread.hpp --- a/hotspot/src/share/vm/runtime/thread.hpp Tue Jul 18 15:43:07 2017 +0200 +++ b/hotspot/src/share/vm/runtime/thread.hpp Thu Jul 13 16:28:14 2017 +0200 @@ -674,12 +674,18 @@ #ifndef USE_LIBRARY_BASED_TLS_ONLY return _thr_current; #else - return ThreadLocalStorage::thread(); + if (ThreadLocalStorage::is_initialized()) { + return ThreadLocalStorage::thread(); + } + return NULL; #endif } inline Thread* Thread::current_or_null_safe() { - return ThreadLocalStorage::thread(); + if (ThreadLocalStorage::is_initialized()) { + return ThreadLocalStorage::thread(); + } + return NULL; } // Name support for threads. non-JavaThread subclasses with multiple