Lines Matching refs:th

389   kmp_info_t *th = __kmp_threads[gtid];  in __kmp_terminate_thread()  local
391 if (!th) in __kmp_terminate_thread()
396 status = pthread_cancel(th->th.th_info.ds.ds_thread); in __kmp_terminate_thread()
409 static kmp_int32 __kmp_set_stack_info(int gtid, kmp_info_t *th) { in __kmp_set_stack_info() argument
445 TCW_PTR(th->th.th_info.ds.ds_stackbase, (((char *)addr) + size)); in __kmp_set_stack_info()
446 TCW_PTR(th->th.th_info.ds.ds_stacksize, size); in __kmp_set_stack_info()
447 TCW_4(th->th.th_info.ds.ds_stackgrow, FALSE); in __kmp_set_stack_info()
453 TCW_PTR(th->th.th_info.ds.ds_stacksize, 0); in __kmp_set_stack_info()
454 TCW_PTR(th->th.th_info.ds.ds_stackbase, &stack_data); in __kmp_set_stack_info()
455 TCW_4(th->th.th_info.ds.ds_stackgrow, TRUE); in __kmp_set_stack_info()
471 gtid = ((kmp_info_t *)thr)->th.th_info.ds.ds_gtid; in __kmp_launch_worker()
478 __kmp_stats_thread_ptr = ((kmp_info_t *)thr)->th.th_stats; in __kmp_launch_worker()
564 __kmp_set_stack_info(((kmp_info_t *)thr)->th.th_info.ds.ds_gtid, in __kmp_launch_monitor()
711 void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) { in __kmp_create_worker() argument
716 th->th.th_info.ds.ds_gtid = gtid; in __kmp_create_worker()
727 th->th.th_stats = __kmp_stats_list->push_back(gtid); in __kmp_create_worker()
731 th->th.th_stats = __kmp_stats_thread_ptr; in __kmp_create_worker()
739 th->th.th_info.ds.ds_thread = pthread_self(); in __kmp_create_worker()
740 __kmp_set_stack_info(gtid, th); in __kmp_create_worker()
741 __kmp_check_stack_overlap(th); in __kmp_create_worker()
803 pthread_create(&handle, &thread_attr, __kmp_launch_worker, (void *)th); in __kmp_create_worker()
822 th->th.th_info.ds.ds_thread = handle; in __kmp_create_worker()
843 void __kmp_create_monitor(kmp_info_t *th) { in __kmp_create_monitor() argument
854 th->th.th_info.ds.ds_tid = 0; // this makes reap_monitor no-op in __kmp_create_monitor()
855 th->th.th_info.ds.ds_gtid = 0; in __kmp_create_monitor()
862 th->th.th_info.ds.ds_tid = KMP_GTID_MONITOR; in __kmp_create_monitor()
863 th->th.th_info.ds.ds_gtid = KMP_GTID_MONITOR; in __kmp_create_monitor()
927 pthread_create(&handle, &thread_attr, __kmp_launch_monitor, (void *)th); in __kmp_create_monitor()
953 th->th.th_info.ds.ds_thread = handle; in __kmp_create_monitor()
978 th->th.th_info.ds.ds_thread)); in __kmp_create_monitor()
990 void __kmp_reap_monitor(kmp_info_t *th) { in __kmp_reap_monitor() argument
996 th->th.th_info.ds.ds_thread)); in __kmp_reap_monitor()
1001 KMP_DEBUG_ASSERT(th->th.th_info.ds.ds_tid == th->th.th_info.ds.ds_gtid); in __kmp_reap_monitor()
1002 if (th->th.th_info.ds.ds_gtid != KMP_GTID_MONITOR) { in __kmp_reap_monitor()
1013 status = pthread_kill(th->th.th_info.ds.ds_thread, 0); in __kmp_reap_monitor()
1018 status = pthread_join(th->th.th_info.ds.ds_thread, &exit_val); in __kmp_reap_monitor()
1019 if (exit_val != th) { in __kmp_reap_monitor()
1023 th->th.th_info.ds.ds_tid = KMP_GTID_DNE; in __kmp_reap_monitor()
1024 th->th.th_info.ds.ds_gtid = KMP_GTID_DNE; in __kmp_reap_monitor()
1028 th->th.th_info.ds.ds_thread)); in __kmp_reap_monitor()
1034 void __kmp_reap_worker(kmp_info_t *th) { in __kmp_reap_worker() argument
1041 10, ("__kmp_reap_worker: try to reap T#%d\n", th->th.th_info.ds.ds_gtid)); in __kmp_reap_worker()
1043 status = pthread_join(th->th.th_info.ds.ds_thread, &exit_val); in __kmp_reap_worker()
1049 if (exit_val != th) { in __kmp_reap_worker()
1052 th->th.th_info.ds.ds_gtid, exit_val)); in __kmp_reap_worker()
1057 th->th.th_info.ds.ds_gtid)); in __kmp_reap_worker()
1328 void __kmp_suspend_initialize_thread(kmp_info_t *th) { in __kmp_suspend_initialize_thread() argument
1329 int old_value = KMP_ATOMIC_LD_RLX(&th->th.th_suspend_init_count); in __kmp_suspend_initialize_thread()
1336 &th->th.th_suspend_init_count, old_value, -1)) { in __kmp_suspend_initialize_thread()
1337 while (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init_count) != new_value) { in __kmp_suspend_initialize_thread()
1343 status = pthread_cond_init(&th->th.th_suspend_cv.c_cond, in __kmp_suspend_initialize_thread()
1346 status = pthread_mutex_init(&th->th.th_suspend_mx.m_mutex, in __kmp_suspend_initialize_thread()
1349 KMP_ATOMIC_ST_REL(&th->th.th_suspend_init_count, new_value); in __kmp_suspend_initialize_thread()
1353 void __kmp_suspend_uninitialize_thread(kmp_info_t *th) { in __kmp_suspend_uninitialize_thread() argument
1354 if (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init_count) > __kmp_fork_count) { in __kmp_suspend_uninitialize_thread()
1359 status = pthread_cond_destroy(&th->th.th_suspend_cv.c_cond); in __kmp_suspend_uninitialize_thread()
1363 status = pthread_mutex_destroy(&th->th.th_suspend_mx.m_mutex); in __kmp_suspend_uninitialize_thread()
1367 --th->th.th_suspend_init_count; in __kmp_suspend_uninitialize_thread()
1368 KMP_DEBUG_ASSERT(KMP_ATOMIC_LD_RLX(&th->th.th_suspend_init_count) == in __kmp_suspend_uninitialize_thread()
1374 int __kmp_try_suspend_mx(kmp_info_t *th) { in __kmp_try_suspend_mx() argument
1375 return (pthread_mutex_trylock(&th->th.th_suspend_mx.m_mutex) == 0); in __kmp_try_suspend_mx()
1378 void __kmp_lock_suspend_mx(kmp_info_t *th) { in __kmp_lock_suspend_mx() argument
1379 int status = pthread_mutex_lock(&th->th.th_suspend_mx.m_mutex); in __kmp_lock_suspend_mx()
1383 void __kmp_unlock_suspend_mx(kmp_info_t *th) { in __kmp_unlock_suspend_mx() argument
1384 int status = pthread_mutex_unlock(&th->th.th_suspend_mx.m_mutex); in __kmp_unlock_suspend_mx()
1393 kmp_info_t *th = __kmp_threads[th_gtid]; in __kmp_suspend_template() local
1400 __kmp_suspend_initialize_thread(th); in __kmp_suspend_template()
1402 __kmp_lock_suspend_mx(th); in __kmp_suspend_template()
1413 __kmp_unlock_suspend_mx(th); in __kmp_suspend_template()
1430 TCW_PTR(th->th.th_sleep_loc, (void *)flag); in __kmp_suspend_template()
1436 __kmp_print_cond(buffer, &th->th.th_suspend_cv); in __kmp_suspend_template()
1443 th->th.th_active = FALSE; in __kmp_suspend_template()
1444 if (th->th.th_active_in_pool) { in __kmp_suspend_template()
1445 th->th.th_active_in_pool = FALSE; in __kmp_suspend_template()
1468 status = pthread_cond_timedwait(&th->th.th_suspend_cv.c_cond, in __kmp_suspend_template()
1469 &th->th.th_suspend_mx.m_mutex, &now); in __kmp_suspend_template()
1474 status = pthread_cond_wait(&th->th.th_suspend_cv.c_cond, in __kmp_suspend_template()
1475 &th->th.th_suspend_mx.m_mutex); in __kmp_suspend_template()
1500 th->th.th_active = TRUE; in __kmp_suspend_template()
1501 if (TCR_4(th->th.th_in_pool)) { in __kmp_suspend_template()
1503 th->th.th_active_in_pool = TRUE; in __kmp_suspend_template()
1510 __kmp_print_cond(buffer, &th->th.th_suspend_cv); in __kmp_suspend_template()
1516 __kmp_unlock_suspend_mx(th); in __kmp_suspend_template()
1542 kmp_info_t *th = __kmp_threads[target_gtid]; in __kmp_resume_template() local
1553 __kmp_suspend_initialize_thread(th); in __kmp_resume_template()
1555 __kmp_lock_suspend_mx(th); in __kmp_resume_template()
1558 flag = (C *)CCAST(void *, th->th.th_sleep_loc); in __kmp_resume_template()
1568 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
1578 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
1586 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_resume_template()
1591 __kmp_print_cond(buffer, &th->th.th_suspend_cv); in __kmp_resume_template()
1596 status = pthread_cond_signal(&th->th.th_suspend_cv.c_cond); in __kmp_resume_template()
1598 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()