Lines Matching refs:th

442   kmp_info_t *th = __kmp_threads[gtid];  in __kmp_terminate_thread()  local
444 if (!th) in __kmp_terminate_thread()
449 status = pthread_cancel(th->th.th_info.ds.ds_thread); in __kmp_terminate_thread()
462 static kmp_int32 __kmp_set_stack_info(int gtid, kmp_info_t *th) { in __kmp_set_stack_info() argument
511 TCW_PTR(th->th.th_info.ds.ds_stackbase, (((char *)addr) + size)); in __kmp_set_stack_info()
512 TCW_PTR(th->th.th_info.ds.ds_stacksize, size); in __kmp_set_stack_info()
513 TCW_4(th->th.th_info.ds.ds_stackgrow, FALSE); in __kmp_set_stack_info()
519 TCW_PTR(th->th.th_info.ds.ds_stacksize, 0); in __kmp_set_stack_info()
520 TCW_PTR(th->th.th_info.ds.ds_stackbase, &stack_data); in __kmp_set_stack_info()
521 TCW_4(th->th.th_info.ds.ds_stackgrow, TRUE); in __kmp_set_stack_info()
537 gtid = ((kmp_info_t *)thr)->th.th_info.ds.ds_gtid; in __kmp_launch_worker()
544 __kmp_stats_thread_ptr = ((kmp_info_t *)thr)->th.th_stats; in __kmp_launch_worker()
630 __kmp_set_stack_info(((kmp_info_t *)thr)->th.th_info.ds.ds_gtid, in __kmp_launch_monitor()
777 void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) { in __kmp_create_worker() argument
782 th->th.th_info.ds.ds_gtid = gtid; in __kmp_create_worker()
793 th->th.th_stats = __kmp_stats_list->push_back(gtid); in __kmp_create_worker()
797 th->th.th_stats = __kmp_stats_thread_ptr; in __kmp_create_worker()
805 th->th.th_info.ds.ds_thread = pthread_self(); in __kmp_create_worker()
806 __kmp_set_stack_info(gtid, th); in __kmp_create_worker()
807 __kmp_check_stack_overlap(th); in __kmp_create_worker()
862 pthread_create(&handle, &thread_attr, __kmp_launch_worker, (void *)th); in __kmp_create_worker()
881 th->th.th_info.ds.ds_thread = handle; in __kmp_create_worker()
902 void __kmp_create_monitor(kmp_info_t *th) { in __kmp_create_monitor() argument
913 th->th.th_info.ds.ds_tid = 0; // this makes reap_monitor no-op in __kmp_create_monitor()
914 th->th.th_info.ds.ds_gtid = 0; in __kmp_create_monitor()
921 th->th.th_info.ds.ds_tid = KMP_GTID_MONITOR; in __kmp_create_monitor()
922 th->th.th_info.ds.ds_gtid = KMP_GTID_MONITOR; in __kmp_create_monitor()
986 pthread_create(&handle, &thread_attr, __kmp_launch_monitor, (void *)th); in __kmp_create_monitor()
1012 th->th.th_info.ds.ds_thread = handle; in __kmp_create_monitor()
1037 th->th.th_info.ds.ds_thread)); in __kmp_create_monitor()
1053 extern "C" void __kmp_reap_monitor(kmp_info_t *th) { in __kmp_reap_monitor() argument
1059 th->th.th_info.ds.ds_thread)); in __kmp_reap_monitor()
1064 KMP_DEBUG_ASSERT(th->th.th_info.ds.ds_tid == th->th.th_info.ds.ds_gtid); in __kmp_reap_monitor()
1065 if (th->th.th_info.ds.ds_gtid != KMP_GTID_MONITOR) { in __kmp_reap_monitor()
1076 status = pthread_kill(th->th.th_info.ds.ds_thread, 0); in __kmp_reap_monitor()
1081 status = pthread_join(th->th.th_info.ds.ds_thread, &exit_val); in __kmp_reap_monitor()
1082 if (exit_val != th) { in __kmp_reap_monitor()
1086 th->th.th_info.ds.ds_tid = KMP_GTID_DNE; in __kmp_reap_monitor()
1087 th->th.th_info.ds.ds_gtid = KMP_GTID_DNE; in __kmp_reap_monitor()
1091 th->th.th_info.ds.ds_thread)); in __kmp_reap_monitor()
1098 extern "C" void __kmp_reap_monitor(kmp_info_t *th) { (void)th; } in __kmp_reap_monitor() argument
1101 void __kmp_reap_worker(kmp_info_t *th) { in __kmp_reap_worker() argument
1108 10, ("__kmp_reap_worker: try to reap T#%d\n", th->th.th_info.ds.ds_gtid)); in __kmp_reap_worker()
1110 status = pthread_join(th->th.th_info.ds.ds_thread, &exit_val); in __kmp_reap_worker()
1116 if (exit_val != th) { in __kmp_reap_worker()
1119 th->th.th_info.ds.ds_gtid, exit_val)); in __kmp_reap_worker()
1126 th->th.th_info.ds.ds_gtid)); in __kmp_reap_worker()
1408 void __kmp_suspend_initialize_thread(kmp_info_t *th) { in __kmp_suspend_initialize_thread() argument
1409 int old_value = KMP_ATOMIC_LD_RLX(&th->th.th_suspend_init_count); in __kmp_suspend_initialize_thread()
1416 &th->th.th_suspend_init_count, old_value, -1)) { in __kmp_suspend_initialize_thread()
1417 while (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init_count) != new_value) { in __kmp_suspend_initialize_thread()
1423 status = pthread_cond_init(&th->th.th_suspend_cv.c_cond, in __kmp_suspend_initialize_thread()
1426 status = pthread_mutex_init(&th->th.th_suspend_mx.m_mutex, in __kmp_suspend_initialize_thread()
1429 KMP_ATOMIC_ST_REL(&th->th.th_suspend_init_count, new_value); in __kmp_suspend_initialize_thread()
1433 void __kmp_suspend_uninitialize_thread(kmp_info_t *th) { in __kmp_suspend_uninitialize_thread() argument
1434 if (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init_count) > __kmp_fork_count) { in __kmp_suspend_uninitialize_thread()
1439 status = pthread_cond_destroy(&th->th.th_suspend_cv.c_cond); in __kmp_suspend_uninitialize_thread()
1443 status = pthread_mutex_destroy(&th->th.th_suspend_mx.m_mutex); in __kmp_suspend_uninitialize_thread()
1447 --th->th.th_suspend_init_count; in __kmp_suspend_uninitialize_thread()
1448 KMP_DEBUG_ASSERT(KMP_ATOMIC_LD_RLX(&th->th.th_suspend_init_count) == in __kmp_suspend_uninitialize_thread()
1454 int __kmp_try_suspend_mx(kmp_info_t *th) { in __kmp_try_suspend_mx() argument
1455 return (pthread_mutex_trylock(&th->th.th_suspend_mx.m_mutex) == 0); in __kmp_try_suspend_mx()
1458 void __kmp_lock_suspend_mx(kmp_info_t *th) { in __kmp_lock_suspend_mx() argument
1459 int status = pthread_mutex_lock(&th->th.th_suspend_mx.m_mutex); in __kmp_lock_suspend_mx()
1463 void __kmp_unlock_suspend_mx(kmp_info_t *th) { in __kmp_unlock_suspend_mx() argument
1464 int status = pthread_mutex_unlock(&th->th.th_suspend_mx.m_mutex); in __kmp_unlock_suspend_mx()
1473 kmp_info_t *th = __kmp_threads[th_gtid]; in __kmp_suspend_template() local
1480 __kmp_suspend_initialize_thread(th); in __kmp_suspend_template()
1482 __kmp_lock_suspend_mx(th); in __kmp_suspend_template()
1490 TCW_PTR(th->th.th_sleep_loc, (void *)flag); in __kmp_suspend_template()
1491 th->th.th_sleep_loc_type = flag->get_type(); in __kmp_suspend_template()
1495 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
1496 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
1497 __kmp_unlock_suspend_mx(th); in __kmp_suspend_template()
1506 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
1507 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
1521 __kmp_print_cond(buffer, &th->th.th_suspend_cv); in __kmp_suspend_template()
1528 th->th.th_active = FALSE; in __kmp_suspend_template()
1529 if (th->th.th_active_in_pool) { in __kmp_suspend_template()
1530 th->th.th_active_in_pool = FALSE; in __kmp_suspend_template()
1537 KMP_DEBUG_ASSERT(th->th.th_sleep_loc); in __kmp_suspend_template()
1538 KMP_DEBUG_ASSERT(flag->get_type() == th->th.th_sleep_loc_type); in __kmp_suspend_template()
1556 status = pthread_cond_timedwait(&th->th.th_suspend_cv.c_cond, in __kmp_suspend_template()
1557 &th->th.th_suspend_mx.m_mutex, &now); in __kmp_suspend_template()
1562 status = pthread_cond_wait(&th->th.th_suspend_cv.c_cond, in __kmp_suspend_template()
1563 &th->th.th_suspend_mx.m_mutex); in __kmp_suspend_template()
1578 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
1579 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
1590 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
1591 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
1602 th->th.th_active = TRUE; in __kmp_suspend_template()
1603 if (TCR_4(th->th.th_in_pool)) { in __kmp_suspend_template()
1605 th->th.th_active_in_pool = TRUE; in __kmp_suspend_template()
1611 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_suspend_template()
1612 th->th.th_sleep_loc_type = flag_unset; in __kmp_suspend_template()
1615 KMP_DEBUG_ASSERT(!th->th.th_sleep_loc); in __kmp_suspend_template()
1619 __kmp_print_cond(buffer, &th->th.th_suspend_cv); in __kmp_suspend_template()
1625 __kmp_unlock_suspend_mx(th); in __kmp_suspend_template()
1659 kmp_info_t *th = __kmp_threads[target_gtid]; in __kmp_resume_template() local
1670 __kmp_suspend_initialize_thread(th); in __kmp_resume_template()
1672 __kmp_lock_suspend_mx(th); in __kmp_resume_template()
1674 if (!flag || flag != th->th.th_sleep_loc) { in __kmp_resume_template()
1677 flag = (C *)CCAST(void *, th->th.th_sleep_loc); in __kmp_resume_template()
1686 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
1688 } else if (flag->get_type() != th->th.th_sleep_loc_type) { in __kmp_resume_template()
1696 th->th.th_sleep_loc_type)); in __kmp_resume_template()
1697 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
1698 __kmp_null_resume_wrapper(th); in __kmp_resume_template()
1706 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()
1712 TCW_PTR(th->th.th_sleep_loc, NULL); in __kmp_resume_template()
1713 th->th.th_sleep_loc_type = flag_unset; in __kmp_resume_template()
1722 __kmp_print_cond(buffer, &th->th.th_suspend_cv); in __kmp_resume_template()
1727 status = pthread_cond_signal(&th->th.th_suspend_cv.c_cond); in __kmp_resume_template()
1729 __kmp_unlock_suspend_mx(th); in __kmp_resume_template()