Lines Matching refs:th
428 kmp_info_t *th = __kmp_threads[gtid]; in __kmp_terminate_thread() local
430 if (!th) in __kmp_terminate_thread()
435 status = pthread_cancel(th->th.th_info.ds.ds_thread); in __kmp_terminate_thread()
448 static kmp_int32 __kmp_set_stack_info(int gtid, kmp_info_t *th) { in __kmp_set_stack_info() argument
484 TCW_PTR(th->th.th_info.ds.ds_stackbase, (((char *)addr) + size)); in __kmp_set_stack_info()
485 TCW_PTR(th->th.th_info.ds.ds_stacksize, size); in __kmp_set_stack_info()
486 TCW_4(th->th.th_info.ds.ds_stackgrow, FALSE); in __kmp_set_stack_info()
492 TCW_PTR(th->th.th_info.ds.ds_stacksize, 0); in __kmp_set_stack_info()
493 TCW_PTR(th->th.th_info.ds.ds_stackbase, &stack_data); in __kmp_set_stack_info()
494 TCW_4(th->th.th_info.ds.ds_stackgrow, TRUE); in __kmp_set_stack_info()
510 gtid = ((kmp_info_t *)thr)->th.th_info.ds.ds_gtid; in __kmp_launch_worker()
517 __kmp_stats_thread_ptr = ((kmp_info_t *)thr)->th.th_stats; in __kmp_launch_worker()
604 __kmp_set_stack_info(((kmp_info_t *)thr)->th.th_info.ds.ds_gtid, in __kmp_launch_monitor()
774 void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) { in __kmp_create_worker() argument
779 th->th.th_info.ds.ds_gtid = gtid; in __kmp_create_worker()
790 th->th.th_stats = __kmp_stats_list->push_back(gtid); in __kmp_create_worker()
794 th->th.th_stats = __kmp_stats_thread_ptr; in __kmp_create_worker()
802 th->th.th_info.ds.ds_thread = pthread_self(); in __kmp_create_worker()
803 __kmp_set_stack_info(gtid, th); in __kmp_create_worker()
804 __kmp_check_stack_overlap(th); in __kmp_create_worker()
859 pthread_create(&handle, &thread_attr, __kmp_launch_worker, (void *)th); in __kmp_create_worker()
878 th->th.th_info.ds.ds_thread = handle; in __kmp_create_worker()
899 void __kmp_create_monitor(kmp_info_t *th) { in __kmp_create_monitor() argument
910 th->th.th_info.ds.ds_tid = 0; // this makes reap_monitor no-op in __kmp_create_monitor()
911 th->th.th_info.ds.ds_gtid = 0; in __kmp_create_monitor()
918 th->th.th_info.ds.ds_tid = KMP_GTID_MONITOR; in __kmp_create_monitor()
919 th->th.th_info.ds.ds_gtid = KMP_GTID_MONITOR; in __kmp_create_monitor()
983 pthread_create(&handle, &thread_attr, __kmp_launch_monitor, (void *)th); in __kmp_create_monitor()
1009 th->th.th_info.ds.ds_thread = handle; in __kmp_create_monitor()
1034 th->th.th_info.ds.ds_thread)); in __kmp_create_monitor()
1046 void __kmp_reap_monitor(kmp_info_t *th) { in __kmp_reap_monitor() argument
1052 th->th.th_info.ds.ds_thread)); in __kmp_reap_monitor()
1057 KMP_DEBUG_ASSERT(th->th.th_info.ds.ds_tid == th->th.th_info.ds.ds_gtid); in __kmp_reap_monitor()
1058 if (th->th.th_info.ds.ds_gtid != KMP_GTID_MONITOR) { in __kmp_reap_monitor()
1069 status = pthread_kill(th->th.th_info.ds.ds_thread, 0); in __kmp_reap_monitor()
1074 status = pthread_join(th->th.th_info.ds.ds_thread, &exit_val); in __kmp_reap_monitor()
1075 if (exit_val != th) { in __kmp_reap_monitor()
1079 th->th.th_info.ds.ds_tid = KMP_GTID_DNE; in __kmp_reap_monitor()
1080 th->th.th_info.ds.ds_gtid = KMP_GTID_DNE; in __kmp_reap_monitor()
1084 th->th.th_info.ds.ds_thread)); in __kmp_reap_monitor()
1090 void __kmp_reap_worker(kmp_info_t *th) { in __kmp_reap_worker() argument
1097 10, ("__kmp_reap_worker: try to reap T#%d\n", th->th.th_info.ds.ds_gtid)); in __kmp_reap_worker()
1099 status = pthread_join(th->th.th_info.ds.ds_thread, &exit_val); in __kmp_reap_worker()
1105 if (exit_val != th) { in __kmp_reap_worker()
1108 th->th.th_info.ds.ds_gtid, exit_val)); in __kmp_reap_worker()
1113 th->th.th_info.ds.ds_gtid)); in __kmp_reap_worker()
1381 static void __kmp_suspend_initialize_thread(kmp_info_t *th) { in __kmp_suspend_initialize_thread() argument
1382 ANNOTATE_HAPPENS_AFTER(&th->th.th_suspend_init_count); in __kmp_suspend_initialize_thread()
1383 if (th->th.th_suspend_init_count <= __kmp_fork_count) { in __kmp_suspend_initialize_thread()
1387 status = pthread_cond_init(&th->th.th_suspend_cv.c_cond, in __kmp_suspend_initialize_thread()
1390 status = pthread_mutex_init(&th->th.th_suspend_mx.m_mutex, in __kmp_suspend_initialize_thread()
1393 *(volatile int *)&th->th.th_suspend_init_count = __kmp_fork_count + 1; in __kmp_suspend_initialize_thread()
1394 ANNOTATE_HAPPENS_BEFORE(&th->th.th_suspend_init_count); in __kmp_suspend_initialize_thread()
1398 void __kmp_suspend_uninitialize_thread(kmp_info_t *th) { in __kmp_suspend_uninitialize_thread() argument
1399 if (th->th.th_suspend_init_count > __kmp_fork_count) { in __kmp_suspend_uninitialize_thread()
1404 status = pthread_cond_destroy(&th->th.th_suspend_cv.c_cond); in __kmp_suspend_uninitialize_thread()
1408 status = pthread_mutex_destroy(&th->th.th_suspend_mx.m_mutex); in __kmp_suspend_uninitialize_thread()
1412 --th->th.th_suspend_init_count; in __kmp_suspend_uninitialize_thread()
1413 KMP_DEBUG_ASSERT(th->th.th_suspend_init_count == __kmp_fork_count); in __kmp_suspend_uninitialize_thread()
1422 kmp_info_t *th = __kmp_threads[th_gtid]; in __kmp_suspend_template() local
1429 __kmp_suspend_initialize_thread(th); in __kmp_suspend_template()
1431 status = pthread_mutex_lock(&th->th.th_suspend_mx.m_mutex); in __kmp_suspend_template()
1455 TCW_PTR(th->th.th_sleep_loc, (void *)flag); in __kmp_suspend_template()
1461 __kmp_print_cond(buffer, &th->th.th_suspend_cv); in __kmp_suspend_template()
1468 th->th.th_active = FALSE; in __kmp_suspend_template()
1469 if (th->th.th_active_in_pool) { in __kmp_suspend_template()
1470 th->th.th_active_in_pool = FALSE; in __kmp_suspend_template()
1493 status = pthread_cond_timedwait(&th->th.th_suspend_cv.c_cond, in __kmp_suspend_template()
1494 &th->th.th_suspend_mx.m_mutex, &now); in __kmp_suspend_template()
1499 status = pthread_cond_wait(&th->th.th_suspend_cv.c_cond, in __kmp_suspend_template()
1500 &th->th.th_suspend_mx.m_mutex); in __kmp_suspend_template()
1525 th->th.th_active = TRUE; in __kmp_suspend_template()
1526 if (TCR_4(th->th.th_in_pool)) { in __kmp_suspend_template()
1528 th->th.th_active_in_pool = TRUE; in __kmp_suspend_template()
1535 __kmp_print_cond(buffer, &th->th.th_suspend_cv); in __kmp_suspend_template()
1541 status = pthread_mutex_unlock(&th->th.th_suspend_mx.m_mutex); in __kmp_suspend_template()
1562 kmp_info_t *th = __kmp_threads[target_gtid]; in __kmp_resume_template() local
1573 __kmp_suspend_initialize_thread(th); in __kmp_resume_template()
1575 status = pthread_mutex_lock(&th->th.th_suspend_mx.m_mutex); in __kmp_resume_template()
1579 flag = (C *)CCAST(void *, th->th.th_sleep_loc); in __kmp_resume_template()
1590 status = pthread_mutex_unlock(&th->th.th_suspend_mx.m_mutex); in __kmp_resume_template()
1601 status = pthread_mutex_unlock(&th->th.th_suspend_mx.m_mutex); in __kmp_resume_template()
1610 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_resume_template()
1615 __kmp_print_cond(buffer, &th->th.th_suspend_cv); in __kmp_resume_template()
1620 status = pthread_cond_signal(&th->th.th_suspend_cv.c_cond); in __kmp_resume_template()
1622 status = pthread_mutex_unlock(&th->th.th_suspend_mx.m_mutex); in __kmp_resume_template()