diff options
Diffstat (limited to 'openmp/runtime/src/z_Windows_NT_util.c')
| -rw-r--r-- | openmp/runtime/src/z_Windows_NT_util.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/openmp/runtime/src/z_Windows_NT_util.c b/openmp/runtime/src/z_Windows_NT_util.c index 61ed2ce897e..db7965a562a 100644 --- a/openmp/runtime/src/z_Windows_NT_util.c +++ b/openmp/runtime/src/z_Windows_NT_util.c @@ -455,11 +455,12 @@ static inline void __kmp_resume_template( int target_gtid, C *flag ) __kmp_suspend_initialize_thread( th ); __kmp_win32_mutex_lock( &th->th.th_suspend_mx ); - if (!flag) { + if (!flag) { // coming from __kmp_null_resume_wrapper flag = (C *)th->th.th_sleep_loc; } - if (!flag) { + // First, check if the flag is null or its type has changed. If so, someone else woke it up. + if (!flag || flag->get_type() != flag->get_ptr_type()) { // get_ptr_type simply shows what flag was cast to KF_TRACE( 5, ( "__kmp_resume_template: T#%d exiting, thread T#%d already awake: flag's loc(%p)\n", gtid, target_gtid, NULL ) ); __kmp_win32_mutex_unlock( &th->th.th_suspend_mx ); |

