[Openmp-commits] [PATCH] D36017: Move lock acquire/release functions to safer locations in task deque cleanup code

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Aug 2 13:07:25 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL309875: Move lock acquire/release functions in task deque cleanup code (authored by jlpeyton).

Changed prior to commit:
  https://reviews.llvm.org/D36017?vs=108704&id=109401#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D36017

Files:
  openmp/trunk/runtime/src/kmp_tasking.cpp


Index: openmp/trunk/runtime/src/kmp_tasking.cpp
===================================================================
--- openmp/trunk/runtime/src/kmp_tasking.cpp
+++ openmp/trunk/runtime/src/kmp_tasking.cpp
@@ -2504,14 +2504,13 @@
 // Deallocates a task deque for a particular thread. Happens at library
 // deallocation so don't need to reset all thread data fields.
 static void __kmp_free_task_deque(kmp_thread_data_t *thread_data) {
-  __kmp_acquire_bootstrap_lock(&thread_data->td.td_deque_lock);
-
   if (thread_data->td.td_deque != NULL) {
+    __kmp_acquire_bootstrap_lock(&thread_data->td.td_deque_lock);
     TCW_4(thread_data->td.td_deque_ntasks, 0);
     __kmp_free(thread_data->td.td_deque);
     thread_data->td.td_deque = NULL;
+    __kmp_release_bootstrap_lock(&thread_data->td.td_deque_lock);
   }
-  __kmp_release_bootstrap_lock(&thread_data->td.td_deque_lock);
 
 #ifdef BUILD_TIED_TASK_STACK
   // GEH: Figure out what to do here for td_susp_tied_tasks


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36017.109401.patch
Type: text/x-patch
Size: 972 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20170802/43b91b2c/attachment-0001.bin>


More information about the Openmp-commits mailing list