diff options
author | Tom Stellard <tstellar@redhat.com> | 2017-11-14 19:11:04 +0000 |
---|---|---|
committer | Tom Stellard <tstellar@redhat.com> | 2017-11-14 19:11:04 +0000 |
commit | 562975c62d5f3e615a535617cc82743e70e3792f (patch) | |
tree | 33e3a3630103b576e3744632ce692f69a5b09865 /openmp | |
parent | c05dace09d461b06486d9e59893ada6dc96c1cd3 (diff) | |
download | llvm-562975c62d5f3e615a535617cc82743e70e3792f.zip llvm-562975c62d5f3e615a535617cc82743e70e3792f.tar.gz llvm-562975c62d5f3e615a535617cc82743e70e3792f.tar.bz2 |
Merging r309875:
------------------------------------------------------------------------
r309875 | jlpeyton | 2017-08-02 13:06:32 -0700 (Wed, 02 Aug 2017) | 11 lines
Move lock acquire/release functions in task deque cleanup code
The original locations can be reached without initializing the lock variable
(td_deque_lock), so it is potentially unsafe. It is guaranteed that the lock
is initialized if the deque (td_deque) is not NULL, and lock functions can be
safely called.
Patch by Hansang Bae
Differential Revision: https://reviews.llvm.org/D36017
------------------------------------------------------------------------
llvm-svn: 318171
Diffstat (limited to 'openmp')
-rw-r--r-- | openmp/runtime/src/kmp_tasking.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/openmp/runtime/src/kmp_tasking.cpp b/openmp/runtime/src/kmp_tasking.cpp index 27207b3..e459642 100644 --- a/openmp/runtime/src/kmp_tasking.cpp +++ b/openmp/runtime/src/kmp_tasking.cpp @@ -2504,14 +2504,13 @@ static void __kmp_realloc_task_deque(kmp_info_t *thread, // 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 |