src/hotspot/share/runtime/thread.cpp
branchstuefe-statistical-history
changeset 57244 a535e674d50d
parent 57221 9653470b7294
parent 54006 a421bdf22394
child 57335 e90b4960bcd6
--- a/src/hotspot/share/runtime/thread.cpp	Fri Sep 07 07:52:35 2018 +0200
+++ b/src/hotspot/share/runtime/thread.cpp	Wed Mar 06 17:31:25 2019 +0100
@@ -1313,7 +1313,9 @@
 }
 
 void NonJavaThread::pre_run() {
+  // Initialize BarrierSet-related data before adding to list.
   assert(BarrierSet::barrier_set() != NULL, "invariant");
+  BarrierSet::barrier_set()->on_thread_attach(this);
   add_to_the_list();
 
   // This is slightly odd in that NamedThread is a subclass, but
@@ -1324,6 +1326,8 @@
 
 void NonJavaThread::post_run() {
   JFR_ONLY(Jfr::on_thread_exit(this);)
+  // Clean up BarrierSet data before removing from list.
+  BarrierSet::barrier_set()->on_thread_detach(this);
   remove_from_the_list();
   // Ensure thread-local-storage is cleared before termination.
   Thread::clear_thread_current();