Lines Matching refs:th
426 kmp_info_t *th = __kmp_threads[gtid]; in __kmp_terminate_thread() local
428 if (!th) in __kmp_terminate_thread()
433 status = pthread_cancel(th->th.th_info.ds.ds_thread); in __kmp_terminate_thread()
446 static kmp_int32 __kmp_set_stack_info(int gtid, kmp_info_t *th) { in __kmp_set_stack_info() argument
482 TCW_PTR(th->th.th_info.ds.ds_stackbase, (((char *)addr) + size)); in __kmp_set_stack_info()
483 TCW_PTR(th->th.th_info.ds.ds_stacksize, size); in __kmp_set_stack_info()
484 TCW_4(th->th.th_info.ds.ds_stackgrow, FALSE); in __kmp_set_stack_info()
490 TCW_PTR(th->th.th_info.ds.ds_stacksize, 0); in __kmp_set_stack_info()
491 TCW_PTR(th->th.th_info.ds.ds_stackbase, &stack_data); in __kmp_set_stack_info()
492 TCW_4(th->th.th_info.ds.ds_stackgrow, TRUE); in __kmp_set_stack_info()
508 gtid = ((kmp_info_t *)thr)->th.th_info.ds.ds_gtid; in __kmp_launch_worker()
515 __kmp_stats_thread_ptr = ((kmp_info_t *)thr)->th.th_stats; in __kmp_launch_worker()
601 __kmp_set_stack_info(((kmp_info_t *)thr)->th.th_info.ds.ds_gtid, in __kmp_launch_monitor()
748 void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) { in __kmp_create_worker() argument
753 th->th.th_info.ds.ds_gtid = gtid; in __kmp_create_worker()
764 th->th.th_stats = __kmp_stats_list->push_back(gtid); in __kmp_create_worker()
768 th->th.th_stats = __kmp_stats_thread_ptr; in __kmp_create_worker()
776 th->th.th_info.ds.ds_thread = pthread_self(); in __kmp_create_worker()
777 __kmp_set_stack_info(gtid, th); in __kmp_create_worker()
778 __kmp_check_stack_overlap(th); in __kmp_create_worker()
833 pthread_create(&handle, &thread_attr, __kmp_launch_worker, (void *)th); in __kmp_create_worker()
852 th->th.th_info.ds.ds_thread = handle; in __kmp_create_worker()
873 void __kmp_create_monitor(kmp_info_t *th) { in __kmp_create_monitor() argument
884 th->th.th_info.ds.ds_tid = 0; // this makes reap_monitor no-op in __kmp_create_monitor()
885 th->th.th_info.ds.ds_gtid = 0; in __kmp_create_monitor()
892 th->th.th_info.ds.ds_tid = KMP_GTID_MONITOR; in __kmp_create_monitor()
893 th->th.th_info.ds.ds_gtid = KMP_GTID_MONITOR; in __kmp_create_monitor()
957 pthread_create(&handle, &thread_attr, __kmp_launch_monitor, (void *)th); in __kmp_create_monitor()
983 th->th.th_info.ds.ds_thread = handle; in __kmp_create_monitor()
1008 th->th.th_info.ds.ds_thread)); in __kmp_create_monitor()
1024 extern "C" void __kmp_reap_monitor(kmp_info_t *th) { in __kmp_reap_monitor() argument
1030 th->th.th_info.ds.ds_thread)); in __kmp_reap_monitor()
1035 KMP_DEBUG_ASSERT(th->th.th_info.ds.ds_tid == th->th.th_info.ds.ds_gtid); in __kmp_reap_monitor()
1036 if (th->th.th_info.ds.ds_gtid != KMP_GTID_MONITOR) { in __kmp_reap_monitor()
1047 status = pthread_kill(th->th.th_info.ds.ds_thread, 0); in __kmp_reap_monitor()
1052 status = pthread_join(th->th.th_info.ds.ds_thread, &exit_val); in __kmp_reap_monitor()
1053 if (exit_val != th) { in __kmp_reap_monitor()
1057 th->th.th_info.ds.ds_tid = KMP_GTID_DNE; in __kmp_reap_monitor()
1058 th->th.th_info.ds.ds_gtid = KMP_GTID_DNE; in __kmp_reap_monitor()
1062 th->th.th_info.ds.ds_thread)); in __kmp_reap_monitor()
1069 extern "C" void __kmp_reap_monitor(kmp_info_t *th) { in __kmp_reap_monitor() argument
1070 (void)th; in __kmp_reap_monitor()
1074 void __kmp_reap_worker(kmp_info_t *th) { in __kmp_reap_worker() argument
1081 10, ("__kmp_reap_worker: try to reap T#%d\n", th->th.th_info.ds.ds_gtid)); in __kmp_reap_worker()
1083 status = pthread_join(th->th.th_info.ds.ds_thread, &exit_val); in __kmp_reap_worker()
1089 if (exit_val != th) { in __kmp_reap_worker()
1092 th->th.th_info.ds.ds_gtid, exit_val)); in __kmp_reap_worker()
1099 th->th.th_info.ds.ds_gtid)); in __kmp_reap_worker()
1380 void __kmp_suspend_initialize_thread(kmp_info_t *th) { in __kmp_suspend_initialize_thread() argument
1381 int old_value = KMP_ATOMIC_LD_RLX(&th->th.th_suspend_init_count); in __kmp_suspend_initialize_thread()
1388 &th->th.th_suspend_init_count, old_value, -1)) { in __kmp_suspend_initialize_thread()
1389 while (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init_count) != new_value) { in __kmp_suspend_initialize_thread()
1395 status = pthread_cond_init(&th->th.th_suspend_cv.c_cond, in __kmp_suspend_initialize_thread()
1398 status = pthread_mutex_init(&th->th.th_suspend_mx.m_mutex, in __kmp_suspend_initialize_thread()
1401 KMP_ATOMIC_ST_REL(&th->th.th_suspend_init_count, new_value); in __kmp_suspend_initialize_thread()
1405 void __kmp_suspend_uninitialize_thread(kmp_info_t *th) { in __kmp_suspend_uninitialize_thread() argument
1406 if (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init_count) > __kmp_fork_count) { in __kmp_suspend_uninitialize_thread()
1411 status = pthread_cond_destroy(&th->th.th_suspend_cv.c_cond); in __kmp_suspend_uninitialize_thread()
1415 status = pthread_mutex_destroy(&th->th.th_suspend_mx.m_mutex); in __kmp_suspend_uninitialize_thread()
1419 --th->th.th_suspend_init_count; in __kmp_suspend_uninitialize_thread()
1420 KMP_DEBUG_ASSERT(KMP_ATOMIC_LD_RLX(&th->th.th_suspend_init_count) == in __kmp_suspend_uninitialize_thread()
1426 int __kmp_try_suspend_mx(kmp_info_t *th) { in __kmp_try_suspend_mx() argument
1427 return (pthread_mutex_trylock(&th->th.th_suspend_mx.m_mutex) == 0); in __kmp_try_suspend_mx()
1430 void __kmp_lock_suspend_mx(kmp_info_t *th) { in __kmp_lock_suspend_mx() argument
1431 int status = pthread_mutex_lock(&th->th.th_suspend_mx.m_mutex); in __kmp_lock_suspend_mx()
1435 void __kmp_unlock_suspend_mx(kmp_info_t *th) { in __kmp_unlock_suspend_mx() argument
1436 int status = pthread_mutex_unlock(&th->th.th_suspend_mx.m_mutex); in __kmp_unlock_suspend_mx()
1445 kmp_info_t *th = __kmp_threads[th_gtid]; in __kmp_suspend_template() local
1452 __kmp_suspend_initialize_thread(th); in __kmp_suspend_template()
1454 __kmp_lock_suspend_mx(th); in __kmp_suspend_template()
1462 TCW_PTR(th->th.th_sleep_loc, (void *)flag); in __kmp_suspend_template()
1463 th->th.th_sleep_loc_type = flag->get_type(); in __kmp_suspend_template()
1467 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
1468 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
1469 __kmp_unlock_suspend_mx(th); in __kmp_suspend_template()
1478 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
1479 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
1493 __kmp_print_cond(buffer, &th->th.th_suspend_cv); in __kmp_suspend_template()
1500 th->th.th_active = FALSE; in __kmp_suspend_template()
1501 if (th->th.th_active_in_pool) { in __kmp_suspend_template()
1502 th->th.th_active_in_pool = FALSE; in __kmp_suspend_template()
1509 KMP_DEBUG_ASSERT(th->th.th_sleep_loc); in __kmp_suspend_template()
1510 KMP_DEBUG_ASSERT(flag->get_type() == th->th.th_sleep_loc_type); in __kmp_suspend_template()
1528 status = pthread_cond_timedwait(&th->th.th_suspend_cv.c_cond, in __kmp_suspend_template()
1529 &th->th.th_suspend_mx.m_mutex, &now); in __kmp_suspend_template()
1534 status = pthread_cond_wait(&th->th.th_suspend_cv.c_cond, in __kmp_suspend_template()
1535 &th->th.th_suspend_mx.m_mutex); in __kmp_suspend_template()
1550 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
1551 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
1562 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
1563 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
1574 th->th.th_active = TRUE; in __kmp_suspend_template()
1575 if (TCR_4(th->th.th_in_pool)) { in __kmp_suspend_template()
1577 th->th.th_active_in_pool = TRUE; in __kmp_suspend_template()
1583 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
1584 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
1587 KMP_DEBUG_ASSERT(!th->th.th_sleep_loc); in __kmp_suspend_template()
1591 __kmp_print_cond(buffer, &th->th.th_suspend_cv); in __kmp_suspend_template()
1597 __kmp_unlock_suspend_mx(th); in __kmp_suspend_template()
1631 kmp_info_t *th = __kmp_threads[target_gtid]; in __kmp_resume_template() local
1642 __kmp_suspend_initialize_thread(th); in __kmp_resume_template()
1644 __kmp_lock_suspend_mx(th); in __kmp_resume_template()
1646 if (!flag || flag != th->th.th_sleep_loc) { in __kmp_resume_template()
1649 flag = (C *)CCAST(void *, th->th.th_sleep_loc); in __kmp_resume_template()
1658 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
1660 } else if (flag->get_type() != th->th.th_sleep_loc_type) { in __kmp_resume_template()
1668 th->th.th_sleep_loc_type)); in __kmp_resume_template()
1669 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
1670 __kmp_null_resume_wrapper(th); in __kmp_resume_template()
1678 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
1684 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_resume_template()
1685 th->th.th_sleep_loc_type = flag_unset; in __kmp_resume_template()
1694 __kmp_print_cond(buffer, &th->th.th_suspend_cv); in __kmp_resume_template()
1699 status = pthread_cond_signal(&th->th.th_suspend_cv.c_cond); in __kmp_resume_template()
1701 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()