src/hotspot/share/runtime/thread.cpp
branchJEP-349-branch
changeset 57360 5d043a159d5c
parent 54808 cf94f5c214f6
child 57878 bffba8d6611a
equal deleted inserted replaced
57359:4cab5edc2950 57360:5d043a159d5c
  3073 // the VM - see CR 6412693, and there are places where a JavaThread can be
  3073 // the VM - see CR 6412693, and there are places where a JavaThread can be
  3074 // seen prior to having it's threadObj set (eg JNI attaching threads and
  3074 // seen prior to having it's threadObj set (eg JNI attaching threads and
  3075 // if vm exit occurs during initialization). These cases can all be accounted
  3075 // if vm exit occurs during initialization). These cases can all be accounted
  3076 // for such that this method never returns NULL.
  3076 // for such that this method never returns NULL.
  3077 const char* JavaThread::get_thread_name() const {
  3077 const char* JavaThread::get_thread_name() const {
  3078 #ifdef ASSERT
       
  3079   // early safepoints can hit while current thread does not yet have TLS
       
  3080   if (!SafepointSynchronize::is_at_safepoint()) {
       
  3081     Thread *cur = Thread::current();
       
  3082     if (!(cur->is_Java_thread() && cur == this)) {
       
  3083       // Current JavaThreads are allowed to get their own name without
       
  3084       // the Threads_lock.
       
  3085       assert_locked_or_safepoint(Threads_lock);
       
  3086     }
       
  3087   }
       
  3088 #endif // ASSERT
       
  3089   return get_thread_name_string();
  3078   return get_thread_name_string();
  3090 }
  3079 }
  3091 
  3080 
  3092 // Returns a non-NULL representation of this thread's name, or a suitable
  3081 // Returns a non-NULL representation of this thread's name, or a suitable
  3093 // descriptive string if there is no set name
  3082 // descriptive string if there is no set name