1311 } |
1311 } |
1312 } |
1312 } |
1313 } |
1313 } |
1314 |
1314 |
1315 void NonJavaThread::pre_run() { |
1315 void NonJavaThread::pre_run() { |
|
1316 // Initialize BarrierSet-related data before adding to list. |
1316 assert(BarrierSet::barrier_set() != NULL, "invariant"); |
1317 assert(BarrierSet::barrier_set() != NULL, "invariant"); |
|
1318 BarrierSet::barrier_set()->on_thread_attach(this); |
1317 add_to_the_list(); |
1319 add_to_the_list(); |
1318 |
1320 |
1319 // This is slightly odd in that NamedThread is a subclass, but |
1321 // This is slightly odd in that NamedThread is a subclass, but |
1320 // in fact name() is defined in Thread |
1322 // in fact name() is defined in Thread |
1321 assert(this->name() != NULL, "thread name was not set before it was started"); |
1323 assert(this->name() != NULL, "thread name was not set before it was started"); |
1322 this->set_native_thread_name(this->name()); |
1324 this->set_native_thread_name(this->name()); |
1323 } |
1325 } |
1324 |
1326 |
1325 void NonJavaThread::post_run() { |
1327 void NonJavaThread::post_run() { |
1326 JFR_ONLY(Jfr::on_thread_exit(this);) |
1328 JFR_ONLY(Jfr::on_thread_exit(this);) |
|
1329 // Clean up BarrierSet data before removing from list. |
|
1330 BarrierSet::barrier_set()->on_thread_detach(this); |
1327 remove_from_the_list(); |
1331 remove_from_the_list(); |
1328 // Ensure thread-local-storage is cleared before termination. |
1332 // Ensure thread-local-storage is cleared before termination. |
1329 Thread::clear_thread_current(); |
1333 Thread::clear_thread_current(); |
1330 } |
1334 } |
1331 |
1335 |