Lines Matching refs:th
202 kmp_info_t *th, C *flag) { in __kmp_win32_cond_wait() argument
244 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_win32_cond_wait()
245 th->th.th_sleep_loc_type = flag_unset; in __kmp_win32_cond_wait()
316 void __kmp_suspend_initialize_thread(kmp_info_t *th) { in __kmp_suspend_initialize_thread() argument
317 int old_value = KMP_ATOMIC_LD_RLX(&th->th.th_suspend_init); in __kmp_suspend_initialize_thread()
324 !__kmp_atomic_compare_store(&th->th.th_suspend_init, old_value, -1)) { in __kmp_suspend_initialize_thread()
325 while (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init) != new_value) { in __kmp_suspend_initialize_thread()
330 __kmp_win32_cond_init(&th->th.th_suspend_cv); in __kmp_suspend_initialize_thread()
331 __kmp_win32_mutex_init(&th->th.th_suspend_mx); in __kmp_suspend_initialize_thread()
332 KMP_ATOMIC_ST_REL(&th->th.th_suspend_init, new_value); in __kmp_suspend_initialize_thread()
336 void __kmp_suspend_uninitialize_thread(kmp_info_t *th) { in __kmp_suspend_uninitialize_thread() argument
337 if (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init)) { in __kmp_suspend_uninitialize_thread()
340 __kmp_win32_cond_destroy(&th->th.th_suspend_cv); in __kmp_suspend_uninitialize_thread()
341 __kmp_win32_mutex_destroy(&th->th.th_suspend_mx); in __kmp_suspend_uninitialize_thread()
342 KMP_ATOMIC_ST_REL(&th->th.th_suspend_init, FALSE); in __kmp_suspend_uninitialize_thread()
346 int __kmp_try_suspend_mx(kmp_info_t *th) { in __kmp_try_suspend_mx() argument
347 return __kmp_win32_mutex_trylock(&th->th.th_suspend_mx); in __kmp_try_suspend_mx()
350 void __kmp_lock_suspend_mx(kmp_info_t *th) { in __kmp_lock_suspend_mx() argument
351 __kmp_win32_mutex_lock(&th->th.th_suspend_mx); in __kmp_lock_suspend_mx()
354 void __kmp_unlock_suspend_mx(kmp_info_t *th) { in __kmp_unlock_suspend_mx() argument
355 __kmp_win32_mutex_unlock(&th->th.th_suspend_mx); in __kmp_unlock_suspend_mx()
362 kmp_info_t *th = __kmp_threads[th_gtid]; in __kmp_suspend_template() local
368 __kmp_suspend_initialize_thread(th); in __kmp_suspend_template()
369 __kmp_lock_suspend_mx(th); in __kmp_suspend_template()
378 TCW_PTR(th->th.th_sleep_loc, (void *)flag); in __kmp_suspend_template()
379 th->th.th_sleep_loc_type = flag->get_type(); in __kmp_suspend_template()
383 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
384 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
385 __kmp_unlock_suspend_mx(th); in __kmp_suspend_template()
395 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
396 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
416 th->th.th_active = FALSE; in __kmp_suspend_template()
417 if (th->th.th_active_in_pool) { in __kmp_suspend_template()
418 th->th.th_active_in_pool = FALSE; in __kmp_suspend_template()
425 KMP_DEBUG_ASSERT(th->th.th_sleep_loc); in __kmp_suspend_template()
426 KMP_DEBUG_ASSERT(th->th.th_sleep_loc_type == flag->get_type()); in __kmp_suspend_template()
428 __kmp_win32_cond_wait(&th->th.th_suspend_cv, &th->th.th_suspend_mx, th, in __kmp_suspend_template()
442 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
443 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
446 KMP_DEBUG_ASSERT(!th->th.th_sleep_loc); in __kmp_suspend_template()
450 th->th.th_active = TRUE; in __kmp_suspend_template()
451 if (TCR_4(th->th.th_in_pool)) { in __kmp_suspend_template()
453 th->th.th_active_in_pool = TRUE; in __kmp_suspend_template()
458 __kmp_unlock_suspend_mx(th); in __kmp_suspend_template()
490 kmp_info_t *th = __kmp_threads[target_gtid]; in __kmp_resume_template() local
499 __kmp_suspend_initialize_thread(th); in __kmp_resume_template()
500 __kmp_lock_suspend_mx(th); in __kmp_resume_template()
502 if (!flag || flag != th->th.th_sleep_loc) { in __kmp_resume_template()
505 flag = (C *)th->th.th_sleep_loc; in __kmp_resume_template()
510 if (!flag || flag->get_type() != th->th.th_sleep_loc_type) { in __kmp_resume_template()
515 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
522 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
528 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_resume_template()
529 th->th.th_sleep_loc_type = flag_unset; in __kmp_resume_template()
535 __kmp_win32_cond_signal(&th->th.th_suspend_cv); in __kmp_resume_template()
536 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
924 kmp_info_t *th = __kmp_threads[gtid]; in __kmp_terminate_thread() local
926 if (!th) in __kmp_terminate_thread()
931 if (TerminateThread(th->th.th_info.ds.ds_thread, (DWORD)-1) == FALSE) { in __kmp_terminate_thread()
934 __kmp_free_handle(th->th.th_info.ds.ds_thread); in __kmp_terminate_thread()
995 gtid = this_thr->th.th_info.ds.ds_gtid; in __kmp_launch_worker()
1022 KMP_FSYNC_RELEASING(&this_thr->th.th_info.ds.ds_alive); in __kmp_launch_worker()
1023 this_thr->th.th_info.ds.ds_thread_id = GetCurrentThreadId(); in __kmp_launch_worker()
1024 TCW_4(this_thr->th.th_info.ds.ds_alive, TRUE); in __kmp_launch_worker()
1028 TCW_PTR(this_thr->th.th_info.ds.ds_stackbase, &stack_data); in __kmp_launch_worker()
1029 KMP_ASSERT(this_thr->th.th_info.ds.ds_stackgrow == FALSE); in __kmp_launch_worker()
1034 KMP_FSYNC_RELEASING(&this_thr->th.th_info.ds.ds_alive); in __kmp_launch_worker()
1035 TCW_4(this_thr->th.th_info.ds.ds_alive, FALSE); in __kmp_launch_worker()
1053 this_thr->th.th_info.ds.ds_thread_id = GetCurrentThreadId(); in __kmp_launch_monitor()
1054 TCW_4(this_thr->th.th_info.ds.ds_alive, TRUE); in __kmp_launch_monitor()
1135 TCW_4(this_thr->th.th_info.ds.ds_alive, FALSE); in __kmp_launch_monitor()
1142 void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) { in __kmp_create_worker() argument
1148 th->th.th_info.ds.ds_gtid = gtid; in __kmp_create_worker()
1159 GetCurrentProcess(), &th->th.th_info.ds.ds_thread, 0, in __kmp_create_worker()
1164 (LPVOID)th, th->th.th_info.ds.ds_thread)); in __kmp_create_worker()
1165 th->th.th_info.ds.ds_thread_id = GetCurrentThreadId(); in __kmp_create_worker()
1169 TCW_PTR(th->th.th_info.ds.ds_stackbase, &stack_data); in __kmp_create_worker()
1170 TCW_PTR(th->th.th_info.ds.ds_stacksize, 0); in __kmp_create_worker()
1171 TCW_4(th->th.th_info.ds.ds_stackgrow, TRUE); in __kmp_create_worker()
1172 __kmp_check_stack_overlap(th); in __kmp_create_worker()
1184 TCW_PTR(th->th.th_info.ds.ds_stacksize, stack_size); in __kmp_create_worker()
1185 TCW_4(th->th.th_info.ds.ds_stackgrow, FALSE); in __kmp_create_worker()
1191 (LPVOID)th, &idThread)); in __kmp_create_worker()
1195 (LPVOID)th, STACK_SIZE_PARAM_IS_A_RESERVATION, &idThread); in __kmp_create_worker()
1202 (LPVOID)th, idThread, handle)); in __kmp_create_worker()
1208 th->th.th_info.ds.ds_thread = handle; in __kmp_create_worker()
1217 int __kmp_still_running(kmp_info_t *th) { in __kmp_still_running() argument
1218 return (WAIT_TIMEOUT == WaitForSingleObject(th->th.th_info.ds.ds_thread, 0)); in __kmp_still_running()
1222 void __kmp_create_monitor(kmp_info_t *th) { in __kmp_create_monitor() argument
1231 th->th.th_info.ds.ds_tid = 0; // this makes reap_monitor no-op in __kmp_create_monitor()
1232 th->th.th_info.ds.ds_gtid = 0; in __kmp_create_monitor()
1249 th->th.th_info.ds.ds_tid = KMP_GTID_MONITOR; in __kmp_create_monitor()
1250 th->th.th_info.ds.ds_gtid = KMP_GTID_MONITOR; in __kmp_create_monitor()
1268 (LPTHREAD_START_ROUTINE)__kmp_launch_monitor, (LPVOID)th, in __kmp_create_monitor()
1274 th->th.th_info.ds.ds_thread = handle; in __kmp_create_monitor()
1279 (void *)th->th.th_info.ds.ds_thread)); in __kmp_create_monitor()
1289 int __kmp_is_thread_alive(kmp_info_t *th, DWORD *exit_val) { in __kmp_is_thread_alive() argument
1291 rc = GetExitCodeThread(th->th.th_info.ds.ds_thread, exit_val); in __kmp_is_thread_alive()
1305 static void __kmp_reap_common(kmp_info_t *th) { in __kmp_reap_common() argument
1311 10, ("__kmp_reap_common: try to reap (%d)\n", th->th.th_info.ds.ds_gtid)); in __kmp_reap_common()
1329 KMP_FSYNC_SPIN_INIT(obj, (void *)&th->th.th_info.ds.ds_alive); in __kmp_reap_common()
1337 __kmp_is_thread_alive(th, &exit_val); in __kmp_reap_common()
1339 } while (exit_val == STILL_ACTIVE && TCR_4(th->th.th_info.ds.ds_alive)); in __kmp_reap_common()
1349 __kmp_free_handle(th->th.th_info.ds.ds_thread); in __kmp_reap_common()
1357 } else if ((void *)e != (void *)th) { in __kmp_reap_common()
1364 th->th.th_info.ds.ds_gtid, th->th.th_info.ds.ds_thread)); in __kmp_reap_common()
1366 th->th.th_info.ds.ds_thread = 0; in __kmp_reap_common()
1367 th->th.th_info.ds.ds_tid = KMP_GTID_DNE; in __kmp_reap_common()
1368 th->th.th_info.ds.ds_gtid = KMP_GTID_DNE; in __kmp_reap_common()
1369 th->th.th_info.ds.ds_thread_id = 0; in __kmp_reap_common()
1375 void __kmp_reap_monitor(kmp_info_t *th) { in __kmp_reap_monitor() argument
1379 (void *)th->th.th_info.ds.ds_thread)); in __kmp_reap_monitor()
1384 KMP_DEBUG_ASSERT(th->th.th_info.ds.ds_tid == th->th.th_info.ds.ds_gtid); in __kmp_reap_monitor()
1385 if (th->th.th_info.ds.ds_gtid != KMP_GTID_MONITOR) { in __kmp_reap_monitor()
1398 th->th.th_info.ds.ds_gtid)); in __kmp_reap_monitor()
1399 __kmp_reap_common(th); in __kmp_reap_monitor()
1407 void __kmp_reap_worker(kmp_info_t *th) { in __kmp_reap_worker() argument
1409 th->th.th_info.ds.ds_gtid)); in __kmp_reap_worker()
1410 __kmp_reap_common(th); in __kmp_reap_worker()