Lines Matching defs:th

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