Skip to content

Commit 1b53672

Browse files
committedAug 2, 2017
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: 309875
1 parent 4f90c82 commit 1b53672

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed
 

‎openmp/runtime/src/kmp_tasking.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -2504,14 +2504,13 @@ static void __kmp_realloc_task_deque(kmp_info_t *thread,
25042504
// Deallocates a task deque for a particular thread. Happens at library
25052505
// deallocation so don't need to reset all thread data fields.
25062506
static void __kmp_free_task_deque(kmp_thread_data_t *thread_data) {
2507-
__kmp_acquire_bootstrap_lock(&thread_data->td.td_deque_lock);
2508-
25092507
if (thread_data->td.td_deque != NULL) {
2508+
__kmp_acquire_bootstrap_lock(&thread_data->td.td_deque_lock);
25102509
TCW_4(thread_data->td.td_deque_ntasks, 0);
25112510
__kmp_free(thread_data->td.td_deque);
25122511
thread_data->td.td_deque = NULL;
2512+
__kmp_release_bootstrap_lock(&thread_data->td.td_deque_lock);
25132513
}
2514-
__kmp_release_bootstrap_lock(&thread_data->td.td_deque_lock);
25152514

25162515
#ifdef BUILD_TIED_TASK_STACK
25172516
// GEH: Figure out what to do here for td_susp_tied_tasks

0 commit comments

Comments
 (0)
Please sign in to comment.