< prev index next >
src/hotspot/os/bsd/os_bsd.cpp
Print this page
rev 52211 : [mq]: tinit
@@ -642,10 +642,13 @@
}
#endif
// Thread start routine for all newly created threads
static void *thread_native_entry(Thread *thread) {
+
+ thread->record_stack_base_and_size();
+
// Try to randomize the cache line index of hot stack frames.
// This helps when threads of the same stack traces evict each other's
// cache lines. The threads can be either from the same JVM instance, or
// from different JVM instances. The benefit is especially true for
// processors with hyperthreading technology.
@@ -694,24 +697,19 @@
sync->wait(Mutex::_no_safepoint_check_flag);
}
}
// call one more level start routine
- thread->run();
+ thread->call_run();
+
+ // Note: at this point the thread object may already have deleted itself.
+ // Prevent dereferencing it from here on out.
+ thread = NULL;
log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").",
os::current_thread_id(), (uintx) pthread_self());
- // If a thread has not deleted itself ("delete this") as part of its
- // termination sequence, we have to ensure thread-local-storage is
- // cleared before we actually terminate. No threads should ever be
- // deleted asynchronously with respect to their termination.
- if (Thread::current_or_null_safe() != NULL) {
- assert(Thread::current_or_null_safe() == thread, "current thread is wrong");
- thread->clear_thread_current();
- }
-
return 0;
}
bool os::create_thread(Thread* thread, ThreadType thr_type,
size_t req_stack_size) {
< prev index next >