Lines Matching refs:th

452   kmp_info_t *th = __kmp_threads[gtid];  in __kmp_terminate_thread()  local
454 if (!th) in __kmp_terminate_thread()
459 status = pthread_cancel(th->th.th_info.ds.ds_thread); in __kmp_terminate_thread()
472 static kmp_int32 __kmp_set_stack_info(int gtid, kmp_info_t *th) { in __kmp_set_stack_info() argument
508 TCW_PTR(th->th.th_info.ds.ds_stackbase, (((char *)addr) + size)); in __kmp_set_stack_info()
509 TCW_PTR(th->th.th_info.ds.ds_stacksize, size); in __kmp_set_stack_info()
510 TCW_4(th->th.th_info.ds.ds_stackgrow, FALSE); in __kmp_set_stack_info()
516 TCW_PTR(th->th.th_info.ds.ds_stacksize, 0); in __kmp_set_stack_info()
517 TCW_PTR(th->th.th_info.ds.ds_stackbase, &stack_data); in __kmp_set_stack_info()
518 TCW_4(th->th.th_info.ds.ds_stackgrow, TRUE); in __kmp_set_stack_info()
534 gtid = ((kmp_info_t *)thr)->th.th_info.ds.ds_gtid; in __kmp_launch_worker()
541 __kmp_stats_thread_ptr = ((kmp_info_t *)thr)->th.th_stats; in __kmp_launch_worker()
626 __kmp_set_stack_info(((kmp_info_t *)thr)->th.th_info.ds.ds_gtid, in __kmp_launch_monitor()
773 void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) { in __kmp_create_worker() argument
778 th->th.th_info.ds.ds_gtid = gtid; in __kmp_create_worker()
789 th->th.th_stats = __kmp_stats_list->push_back(gtid); in __kmp_create_worker()
793 th->th.th_stats = __kmp_stats_thread_ptr; in __kmp_create_worker()
801 th->th.th_info.ds.ds_thread = pthread_self(); in __kmp_create_worker()
802 __kmp_set_stack_info(gtid, th); in __kmp_create_worker()
803 __kmp_check_stack_overlap(th); in __kmp_create_worker()
865 pthread_create(&handle, &thread_attr, __kmp_launch_worker, (void *)th); in __kmp_create_worker()
884 th->th.th_info.ds.ds_thread = handle; in __kmp_create_worker()
905 void __kmp_create_monitor(kmp_info_t *th) { in __kmp_create_monitor() argument
916 th->th.th_info.ds.ds_tid = 0; // this makes reap_monitor no-op in __kmp_create_monitor()
917 th->th.th_info.ds.ds_gtid = 0; in __kmp_create_monitor()
924 th->th.th_info.ds.ds_tid = KMP_GTID_MONITOR; in __kmp_create_monitor()
925 th->th.th_info.ds.ds_gtid = KMP_GTID_MONITOR; in __kmp_create_monitor()
989 pthread_create(&handle, &thread_attr, __kmp_launch_monitor, (void *)th); in __kmp_create_monitor()
1015 th->th.th_info.ds.ds_thread = handle; in __kmp_create_monitor()
1040 th->th.th_info.ds.ds_thread)); in __kmp_create_monitor()
1052 void __kmp_reap_monitor(kmp_info_t *th) { in __kmp_reap_monitor() argument
1058 th->th.th_info.ds.ds_thread)); in __kmp_reap_monitor()
1063 KMP_DEBUG_ASSERT(th->th.th_info.ds.ds_tid == th->th.th_info.ds.ds_gtid); in __kmp_reap_monitor()
1064 if (th->th.th_info.ds.ds_gtid != KMP_GTID_MONITOR) { in __kmp_reap_monitor()
1075 status = pthread_kill(th->th.th_info.ds.ds_thread, 0); in __kmp_reap_monitor()
1080 status = pthread_join(th->th.th_info.ds.ds_thread, &exit_val); in __kmp_reap_monitor()
1081 if (exit_val != th) { in __kmp_reap_monitor()
1085 th->th.th_info.ds.ds_tid = KMP_GTID_DNE; in __kmp_reap_monitor()
1086 th->th.th_info.ds.ds_gtid = KMP_GTID_DNE; in __kmp_reap_monitor()
1090 th->th.th_info.ds.ds_thread)); in __kmp_reap_monitor()
1096 void __kmp_reap_worker(kmp_info_t *th) { in __kmp_reap_worker() argument
1103 10, ("__kmp_reap_worker: try to reap T#%d\n", th->th.th_info.ds.ds_gtid)); in __kmp_reap_worker()
1105 status = pthread_join(th->th.th_info.ds.ds_thread, &exit_val); in __kmp_reap_worker()
1111 if (exit_val != th) { in __kmp_reap_worker()
1114 th->th.th_info.ds.ds_gtid, exit_val)); in __kmp_reap_worker()
1119 th->th.th_info.ds.ds_gtid)); in __kmp_reap_worker()
1386 void __kmp_suspend_initialize_thread(kmp_info_t *th) { in __kmp_suspend_initialize_thread() argument
1387 ANNOTATE_HAPPENS_AFTER(&th->th.th_suspend_init_count); in __kmp_suspend_initialize_thread()
1388 int old_value = KMP_ATOMIC_LD_RLX(&th->th.th_suspend_init_count); in __kmp_suspend_initialize_thread()
1395 !__kmp_atomic_compare_store(&th->th.th_suspend_init_count, old_value, in __kmp_suspend_initialize_thread()
1397 while (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init_count) != new_value) { in __kmp_suspend_initialize_thread()
1403 status = pthread_cond_init(&th->th.th_suspend_cv.c_cond, in __kmp_suspend_initialize_thread()
1406 status = pthread_mutex_init(&th->th.th_suspend_mx.m_mutex, in __kmp_suspend_initialize_thread()
1409 KMP_ATOMIC_ST_REL(&th->th.th_suspend_init_count, new_value); in __kmp_suspend_initialize_thread()
1410 ANNOTATE_HAPPENS_BEFORE(&th->th.th_suspend_init_count); in __kmp_suspend_initialize_thread()
1414 void __kmp_suspend_uninitialize_thread(kmp_info_t *th) { in __kmp_suspend_uninitialize_thread() argument
1415 if (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init_count) > __kmp_fork_count) { in __kmp_suspend_uninitialize_thread()
1420 status = pthread_cond_destroy(&th->th.th_suspend_cv.c_cond); in __kmp_suspend_uninitialize_thread()
1424 status = pthread_mutex_destroy(&th->th.th_suspend_mx.m_mutex); in __kmp_suspend_uninitialize_thread()
1428 --th->th.th_suspend_init_count; in __kmp_suspend_uninitialize_thread()
1429 KMP_DEBUG_ASSERT(KMP_ATOMIC_LD_RLX(&th->th.th_suspend_init_count) == in __kmp_suspend_uninitialize_thread()
1435 int __kmp_try_suspend_mx(kmp_info_t *th) { in __kmp_try_suspend_mx() argument
1436 return (pthread_mutex_trylock(&th->th.th_suspend_mx.m_mutex) == 0); in __kmp_try_suspend_mx()
1439 void __kmp_lock_suspend_mx(kmp_info_t *th) { in __kmp_lock_suspend_mx() argument
1440 int status = pthread_mutex_lock(&th->th.th_suspend_mx.m_mutex); in __kmp_lock_suspend_mx()
1444 void __kmp_unlock_suspend_mx(kmp_info_t *th) { in __kmp_unlock_suspend_mx() argument
1445 int status = pthread_mutex_unlock(&th->th.th_suspend_mx.m_mutex); in __kmp_unlock_suspend_mx()
1454 kmp_info_t *th = __kmp_threads[th_gtid]; in __kmp_suspend_template() local
1461 __kmp_suspend_initialize_thread(th); in __kmp_suspend_template()
1463 __kmp_lock_suspend_mx(th); in __kmp_suspend_template()
1474 __kmp_unlock_suspend_mx(th); in __kmp_suspend_template()
1491 TCW_PTR(th->th.th_sleep_loc, (void *)flag); in __kmp_suspend_template()
1497 __kmp_print_cond(buffer, &th->th.th_suspend_cv); in __kmp_suspend_template()
1504 th->th.th_active = FALSE; in __kmp_suspend_template()
1505 if (th->th.th_active_in_pool) { in __kmp_suspend_template()
1506 th->th.th_active_in_pool = FALSE; in __kmp_suspend_template()
1529 status = pthread_cond_timedwait(&th->th.th_suspend_cv.c_cond, in __kmp_suspend_template()
1530 &th->th.th_suspend_mx.m_mutex, &now); in __kmp_suspend_template()
1535 status = pthread_cond_wait(&th->th.th_suspend_cv.c_cond, in __kmp_suspend_template()
1536 &th->th.th_suspend_mx.m_mutex); in __kmp_suspend_template()
1561 th->th.th_active = TRUE; in __kmp_suspend_template()
1562 if (TCR_4(th->th.th_in_pool)) { in __kmp_suspend_template()
1564 th->th.th_active_in_pool = TRUE; in __kmp_suspend_template()
1571 __kmp_print_cond(buffer, &th->th.th_suspend_cv); in __kmp_suspend_template()
1577 __kmp_unlock_suspend_mx(th); in __kmp_suspend_template()
1603 kmp_info_t *th = __kmp_threads[target_gtid]; in __kmp_resume_template() local
1614 __kmp_suspend_initialize_thread(th); in __kmp_resume_template()
1616 __kmp_lock_suspend_mx(th); in __kmp_resume_template()
1619 flag = (C *)CCAST(void *, th->th.th_sleep_loc); in __kmp_resume_template()
1629 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
1639 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
1647 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_resume_template()
1652 __kmp_print_cond(buffer, &th->th.th_suspend_cv); in __kmp_resume_template()
1657 status = pthread_cond_signal(&th->th.th_suspend_cv.c_cond); in __kmp_resume_template()
1659 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()