Lines Matching refs:th

202                                   kmp_info_t *th, C *flag) {  in __kmp_win32_cond_wait()  argument
245 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_win32_cond_wait()
317 void __kmp_suspend_initialize_thread(kmp_info_t *th) { in __kmp_suspend_initialize_thread() argument
318 int old_value = KMP_ATOMIC_LD_RLX(&th->th.th_suspend_init); in __kmp_suspend_initialize_thread()
325 !__kmp_atomic_compare_store(&th->th.th_suspend_init, old_value, -1)) { in __kmp_suspend_initialize_thread()
326 while (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init) != new_value) { in __kmp_suspend_initialize_thread()
331 __kmp_win32_cond_init(&th->th.th_suspend_cv); in __kmp_suspend_initialize_thread()
332 __kmp_win32_mutex_init(&th->th.th_suspend_mx); in __kmp_suspend_initialize_thread()
333 KMP_ATOMIC_ST_REL(&th->th.th_suspend_init, new_value); in __kmp_suspend_initialize_thread()
337 void __kmp_suspend_uninitialize_thread(kmp_info_t *th) { in __kmp_suspend_uninitialize_thread() argument
338 if (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init)) { in __kmp_suspend_uninitialize_thread()
341 __kmp_win32_cond_destroy(&th->th.th_suspend_cv); in __kmp_suspend_uninitialize_thread()
342 __kmp_win32_mutex_destroy(&th->th.th_suspend_mx); in __kmp_suspend_uninitialize_thread()
343 KMP_ATOMIC_ST_REL(&th->th.th_suspend_init, FALSE); in __kmp_suspend_uninitialize_thread()
347 int __kmp_try_suspend_mx(kmp_info_t *th) { in __kmp_try_suspend_mx() argument
348 return __kmp_win32_mutex_trylock(&th->th.th_suspend_mx); in __kmp_try_suspend_mx()
351 void __kmp_lock_suspend_mx(kmp_info_t *th) { in __kmp_lock_suspend_mx() argument
352 __kmp_win32_mutex_lock(&th->th.th_suspend_mx); in __kmp_lock_suspend_mx()
355 void __kmp_unlock_suspend_mx(kmp_info_t *th) { in __kmp_unlock_suspend_mx() argument
356 __kmp_win32_mutex_unlock(&th->th.th_suspend_mx); in __kmp_unlock_suspend_mx()
363 kmp_info_t *th = __kmp_threads[th_gtid]; in __kmp_suspend_template() local
369 __kmp_suspend_initialize_thread(th); in __kmp_suspend_template()
370 __kmp_lock_suspend_mx(th); in __kmp_suspend_template()
382 __kmp_unlock_suspend_mx(th); in __kmp_suspend_template()
403 TCW_PTR(th->th.th_sleep_loc, (void *)flag); in __kmp_suspend_template()
411 th->th.th_active = FALSE; in __kmp_suspend_template()
412 if (th->th.th_active_in_pool) { in __kmp_suspend_template()
413 th->th.th_active_in_pool = FALSE; in __kmp_suspend_template()
418 __kmp_win32_cond_wait(&th->th.th_suspend_cv, &th->th.th_suspend_mx, th, in __kmp_suspend_template()
421 __kmp_win32_cond_wait(&th->th.th_suspend_cv, &th->th.th_suspend_mx, th, in __kmp_suspend_template()
436 th->th.th_active = TRUE; in __kmp_suspend_template()
437 if (TCR_4(th->th.th_in_pool)) { in __kmp_suspend_template()
439 th->th.th_active_in_pool = TRUE; in __kmp_suspend_template()
444 __kmp_unlock_suspend_mx(th); in __kmp_suspend_template()
468 kmp_info_t *th = __kmp_threads[target_gtid]; in __kmp_resume_template() local
477 __kmp_suspend_initialize_thread(th); in __kmp_resume_template()
478 __kmp_lock_suspend_mx(th); in __kmp_resume_template()
481 flag = (C *)th->th.th_sleep_loc; in __kmp_resume_template()
492 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
501 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
505 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_resume_template()
510 __kmp_win32_cond_signal(&th->th.th_suspend_cv); in __kmp_resume_template()
511 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
891 kmp_info_t *th = __kmp_threads[gtid]; in __kmp_terminate_thread() local
893 if (!th) in __kmp_terminate_thread()
898 if (TerminateThread(th->th.th_info.ds.ds_thread, (DWORD)-1) == FALSE) { in __kmp_terminate_thread()
901 __kmp_free_handle(th->th.th_info.ds.ds_thread); in __kmp_terminate_thread()
967 gtid = this_thr->th.th_info.ds.ds_gtid; in __kmp_launch_worker()
993 KMP_FSYNC_RELEASING(&this_thr->th.th_info.ds.ds_alive); in __kmp_launch_worker()
994 this_thr->th.th_info.ds.ds_thread_id = GetCurrentThreadId(); in __kmp_launch_worker()
995 TCW_4(this_thr->th.th_info.ds.ds_alive, TRUE); in __kmp_launch_worker()
999 TCW_PTR(this_thr->th.th_info.ds.ds_stackbase, &stack_data); in __kmp_launch_worker()
1000 KMP_ASSERT(this_thr->th.th_info.ds.ds_stackgrow == FALSE); in __kmp_launch_worker()
1005 KMP_FSYNC_RELEASING(&this_thr->th.th_info.ds.ds_alive); in __kmp_launch_worker()
1006 TCW_4(this_thr->th.th_info.ds.ds_alive, FALSE); in __kmp_launch_worker()
1024 this_thr->th.th_info.ds.ds_thread_id = GetCurrentThreadId(); in __kmp_launch_monitor()
1025 TCW_4(this_thr->th.th_info.ds.ds_alive, TRUE); in __kmp_launch_monitor()
1106 TCW_4(this_thr->th.th_info.ds.ds_alive, FALSE); in __kmp_launch_monitor()
1113 void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) { in __kmp_create_worker() argument
1119 th->th.th_info.ds.ds_gtid = gtid; in __kmp_create_worker()
1130 GetCurrentProcess(), &th->th.th_info.ds.ds_thread, 0, in __kmp_create_worker()
1135 (LPVOID)th, th->th.th_info.ds.ds_thread)); in __kmp_create_worker()
1136 th->th.th_info.ds.ds_thread_id = GetCurrentThreadId(); in __kmp_create_worker()
1140 TCW_PTR(th->th.th_info.ds.ds_stackbase, &stack_data); in __kmp_create_worker()
1141 TCW_PTR(th->th.th_info.ds.ds_stacksize, 0); in __kmp_create_worker()
1142 TCW_4(th->th.th_info.ds.ds_stackgrow, TRUE); in __kmp_create_worker()
1143 __kmp_check_stack_overlap(th); in __kmp_create_worker()
1155 TCW_PTR(th->th.th_info.ds.ds_stacksize, stack_size); in __kmp_create_worker()
1156 TCW_4(th->th.th_info.ds.ds_stackgrow, FALSE); in __kmp_create_worker()
1162 (LPVOID)th, &idThread)); in __kmp_create_worker()
1166 (LPVOID)th, STACK_SIZE_PARAM_IS_A_RESERVATION, &idThread); in __kmp_create_worker()
1173 (LPVOID)th, idThread, handle)); in __kmp_create_worker()
1179 th->th.th_info.ds.ds_thread = handle; in __kmp_create_worker()
1188 int __kmp_still_running(kmp_info_t *th) { in __kmp_still_running() argument
1189 return (WAIT_TIMEOUT == WaitForSingleObject(th->th.th_info.ds.ds_thread, 0)); in __kmp_still_running()
1193 void __kmp_create_monitor(kmp_info_t *th) { in __kmp_create_monitor() argument
1202 th->th.th_info.ds.ds_tid = 0; // this makes reap_monitor no-op in __kmp_create_monitor()
1203 th->th.th_info.ds.ds_gtid = 0; in __kmp_create_monitor()
1220 th->th.th_info.ds.ds_tid = KMP_GTID_MONITOR; in __kmp_create_monitor()
1221 th->th.th_info.ds.ds_gtid = KMP_GTID_MONITOR; in __kmp_create_monitor()
1239 (LPTHREAD_START_ROUTINE)__kmp_launch_monitor, (LPVOID)th, in __kmp_create_monitor()
1245 th->th.th_info.ds.ds_thread = handle; in __kmp_create_monitor()
1250 (void *)th->th.th_info.ds.ds_thread)); in __kmp_create_monitor()
1260 int __kmp_is_thread_alive(kmp_info_t *th, DWORD *exit_val) { in __kmp_is_thread_alive() argument
1262 rc = GetExitCodeThread(th->th.th_info.ds.ds_thread, exit_val); in __kmp_is_thread_alive()
1276 static void __kmp_reap_common(kmp_info_t *th) { in __kmp_reap_common() argument
1282 10, ("__kmp_reap_common: try to reap (%d)\n", th->th.th_info.ds.ds_gtid)); in __kmp_reap_common()
1299 KMP_FSYNC_SPIN_INIT(obj, (void *)&th->th.th_info.ds.ds_alive); in __kmp_reap_common()
1306 __kmp_is_thread_alive(th, &exit_val); in __kmp_reap_common()
1308 } while (exit_val == STILL_ACTIVE && TCR_4(th->th.th_info.ds.ds_alive)); in __kmp_reap_common()
1318 __kmp_free_handle(th->th.th_info.ds.ds_thread); in __kmp_reap_common()
1325 } else if ((void *)exit_val != (void *)th) { in __kmp_reap_common()
1332 th->th.th_info.ds.ds_gtid, th->th.th_info.ds.ds_thread)); in __kmp_reap_common()
1334 th->th.th_info.ds.ds_thread = 0; in __kmp_reap_common()
1335 th->th.th_info.ds.ds_tid = KMP_GTID_DNE; in __kmp_reap_common()
1336 th->th.th_info.ds.ds_gtid = KMP_GTID_DNE; in __kmp_reap_common()
1337 th->th.th_info.ds.ds_thread_id = 0; in __kmp_reap_common()
1343 void __kmp_reap_monitor(kmp_info_t *th) { in __kmp_reap_monitor() argument
1347 (void *)th->th.th_info.ds.ds_thread)); in __kmp_reap_monitor()
1352 KMP_DEBUG_ASSERT(th->th.th_info.ds.ds_tid == th->th.th_info.ds.ds_gtid); in __kmp_reap_monitor()
1353 if (th->th.th_info.ds.ds_gtid != KMP_GTID_MONITOR) { in __kmp_reap_monitor()
1366 th->th.th_info.ds.ds_gtid)); in __kmp_reap_monitor()
1367 __kmp_reap_common(th); in __kmp_reap_monitor()
1375 void __kmp_reap_worker(kmp_info_t *th) { in __kmp_reap_worker() argument
1377 th->th.th_info.ds.ds_gtid)); in __kmp_reap_worker()
1378 __kmp_reap_common(th); in __kmp_reap_worker()