Lines Matching refs:th
203 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()
246 th->th.th_sleep_loc_type = flag_unset; 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()
379 TCW_PTR(th->th.th_sleep_loc, (void *)flag); in __kmp_suspend_template()
380 th->th.th_sleep_loc_type = flag->get_type(); in __kmp_suspend_template()
384 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
385 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
386 __kmp_unlock_suspend_mx(th); in __kmp_suspend_template()
396 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
397 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
417 th->th.th_active = FALSE; in __kmp_suspend_template()
418 if (th->th.th_active_in_pool) { in __kmp_suspend_template()
419 th->th.th_active_in_pool = FALSE; in __kmp_suspend_template()
426 KMP_DEBUG_ASSERT(th->th.th_sleep_loc); in __kmp_suspend_template()
427 KMP_DEBUG_ASSERT(th->th.th_sleep_loc_type == flag->get_type()); in __kmp_suspend_template()
429 __kmp_win32_cond_wait(&th->th.th_suspend_cv, &th->th.th_suspend_mx, th, in __kmp_suspend_template()
443 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
444 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
447 KMP_DEBUG_ASSERT(!th->th.th_sleep_loc); in __kmp_suspend_template()
451 th->th.th_active = TRUE; in __kmp_suspend_template()
452 if (TCR_4(th->th.th_in_pool)) { in __kmp_suspend_template()
454 th->th.th_active_in_pool = TRUE; in __kmp_suspend_template()
459 __kmp_unlock_suspend_mx(th); in __kmp_suspend_template()
491 kmp_info_t *th = __kmp_threads[target_gtid]; in __kmp_resume_template() local
500 __kmp_suspend_initialize_thread(th); in __kmp_resume_template()
501 __kmp_lock_suspend_mx(th); in __kmp_resume_template()
503 if (!flag || flag != th->th.th_sleep_loc) { in __kmp_resume_template()
506 flag = (C *)th->th.th_sleep_loc; in __kmp_resume_template()
511 if (!flag || flag->get_type() != th->th.th_sleep_loc_type) { in __kmp_resume_template()
516 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
523 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
529 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_resume_template()
530 th->th.th_sleep_loc_type = flag_unset; in __kmp_resume_template()
536 __kmp_win32_cond_signal(&th->th.th_suspend_cv); in __kmp_resume_template()
537 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
926 kmp_info_t *th = __kmp_threads[gtid]; in __kmp_terminate_thread() local
928 if (!th) in __kmp_terminate_thread()
933 if (TerminateThread(th->th.th_info.ds.ds_thread, (DWORD)-1) == FALSE) { in __kmp_terminate_thread()
936 __kmp_free_handle(th->th.th_info.ds.ds_thread); in __kmp_terminate_thread()
997 gtid = this_thr->th.th_info.ds.ds_gtid; in __kmp_launch_worker()
1024 KMP_FSYNC_RELEASING(&this_thr->th.th_info.ds.ds_alive); in __kmp_launch_worker()
1025 this_thr->th.th_info.ds.ds_thread_id = GetCurrentThreadId(); in __kmp_launch_worker()
1026 TCW_4(this_thr->th.th_info.ds.ds_alive, TRUE); in __kmp_launch_worker()
1030 TCW_PTR(this_thr->th.th_info.ds.ds_stackbase, &stack_data); in __kmp_launch_worker()
1031 KMP_ASSERT(this_thr->th.th_info.ds.ds_stackgrow == FALSE); in __kmp_launch_worker()
1036 KMP_FSYNC_RELEASING(&this_thr->th.th_info.ds.ds_alive); in __kmp_launch_worker()
1037 TCW_4(this_thr->th.th_info.ds.ds_alive, FALSE); in __kmp_launch_worker()
1055 this_thr->th.th_info.ds.ds_thread_id = GetCurrentThreadId(); in __kmp_launch_monitor()
1056 TCW_4(this_thr->th.th_info.ds.ds_alive, TRUE); in __kmp_launch_monitor()
1137 TCW_4(this_thr->th.th_info.ds.ds_alive, FALSE); in __kmp_launch_monitor()
1144 void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) { in __kmp_create_worker() argument
1150 th->th.th_info.ds.ds_gtid = gtid; in __kmp_create_worker()
1161 GetCurrentProcess(), &th->th.th_info.ds.ds_thread, 0, in __kmp_create_worker()
1166 (LPVOID)th, th->th.th_info.ds.ds_thread)); in __kmp_create_worker()
1167 th->th.th_info.ds.ds_thread_id = GetCurrentThreadId(); in __kmp_create_worker()
1171 TCW_PTR(th->th.th_info.ds.ds_stackbase, &stack_data); in __kmp_create_worker()
1172 TCW_PTR(th->th.th_info.ds.ds_stacksize, 0); in __kmp_create_worker()
1173 TCW_4(th->th.th_info.ds.ds_stackgrow, TRUE); in __kmp_create_worker()
1174 __kmp_check_stack_overlap(th); in __kmp_create_worker()
1186 TCW_PTR(th->th.th_info.ds.ds_stacksize, stack_size); in __kmp_create_worker()
1187 TCW_4(th->th.th_info.ds.ds_stackgrow, FALSE); in __kmp_create_worker()
1193 (LPVOID)th, &idThread)); in __kmp_create_worker()
1197 (LPVOID)th, STACK_SIZE_PARAM_IS_A_RESERVATION, &idThread); in __kmp_create_worker()
1204 (LPVOID)th, idThread, handle)); in __kmp_create_worker()
1210 th->th.th_info.ds.ds_thread = handle; in __kmp_create_worker()
1219 int __kmp_still_running(kmp_info_t *th) { in __kmp_still_running() argument
1220 return (WAIT_TIMEOUT == WaitForSingleObject(th->th.th_info.ds.ds_thread, 0)); in __kmp_still_running()
1224 void __kmp_create_monitor(kmp_info_t *th) { in __kmp_create_monitor() argument
1233 th->th.th_info.ds.ds_tid = 0; // this makes reap_monitor no-op in __kmp_create_monitor()
1234 th->th.th_info.ds.ds_gtid = 0; in __kmp_create_monitor()
1251 th->th.th_info.ds.ds_tid = KMP_GTID_MONITOR; in __kmp_create_monitor()
1252 th->th.th_info.ds.ds_gtid = KMP_GTID_MONITOR; in __kmp_create_monitor()
1270 (LPTHREAD_START_ROUTINE)__kmp_launch_monitor, (LPVOID)th, in __kmp_create_monitor()
1276 th->th.th_info.ds.ds_thread = handle; in __kmp_create_monitor()
1281 (void *)th->th.th_info.ds.ds_thread)); in __kmp_create_monitor()
1291 int __kmp_is_thread_alive(kmp_info_t *th, DWORD *exit_val) { in __kmp_is_thread_alive() argument
1293 rc = GetExitCodeThread(th->th.th_info.ds.ds_thread, exit_val); in __kmp_is_thread_alive()
1307 static void __kmp_reap_common(kmp_info_t *th) { in __kmp_reap_common() argument
1313 10, ("__kmp_reap_common: try to reap (%d)\n", th->th.th_info.ds.ds_gtid)); in __kmp_reap_common()
1331 KMP_FSYNC_SPIN_INIT(obj, (void *)&th->th.th_info.ds.ds_alive); in __kmp_reap_common()
1339 __kmp_is_thread_alive(th, &exit_val); in __kmp_reap_common()
1341 } while (exit_val == STILL_ACTIVE && TCR_4(th->th.th_info.ds.ds_alive)); in __kmp_reap_common()
1351 __kmp_free_handle(th->th.th_info.ds.ds_thread); in __kmp_reap_common()
1359 } else if ((void *)e != (void *)th) { in __kmp_reap_common()
1366 th->th.th_info.ds.ds_gtid, th->th.th_info.ds.ds_thread)); in __kmp_reap_common()
1368 th->th.th_info.ds.ds_thread = 0; in __kmp_reap_common()
1369 th->th.th_info.ds.ds_tid = KMP_GTID_DNE; in __kmp_reap_common()
1370 th->th.th_info.ds.ds_gtid = KMP_GTID_DNE; in __kmp_reap_common()
1371 th->th.th_info.ds.ds_thread_id = 0; in __kmp_reap_common()
1377 void __kmp_reap_monitor(kmp_info_t *th) { in __kmp_reap_monitor() argument
1381 (void *)th->th.th_info.ds.ds_thread)); in __kmp_reap_monitor()
1386 KMP_DEBUG_ASSERT(th->th.th_info.ds.ds_tid == th->th.th_info.ds.ds_gtid); in __kmp_reap_monitor()
1387 if (th->th.th_info.ds.ds_gtid != KMP_GTID_MONITOR) { in __kmp_reap_monitor()
1400 th->th.th_info.ds.ds_gtid)); in __kmp_reap_monitor()
1401 __kmp_reap_common(th); in __kmp_reap_monitor()
1409 void __kmp_reap_worker(kmp_info_t *th) { in __kmp_reap_worker() argument
1411 th->th.th_info.ds.ds_gtid)); in __kmp_reap_worker()
1412 __kmp_reap_common(th); in __kmp_reap_worker()