--- a/hotspot/src/share/vm/runtime/thread.hpp Tue Jul 18 15:46:04 2017 -0400
+++ b/hotspot/src/share/vm/runtime/thread.hpp Tue Jul 18 19:56:18 2017 +0000
@@ -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