Changeset View
Changeset View
Standalone View
Standalone View
openmp/trunk/runtime/src/z_Linux_util.cpp
Show First 20 Lines • Show All 1,753 Lines • ▼ Show 20 Lines | |||||
void __kmp_clear_system_time(void) { | void __kmp_clear_system_time(void) { | ||||
struct timeval tval; | struct timeval tval; | ||||
int status; | int status; | ||||
status = gettimeofday(&tval, NULL); | status = gettimeofday(&tval, NULL); | ||||
KMP_CHECK_SYSFAIL_ERRNO("gettimeofday", status); | KMP_CHECK_SYSFAIL_ERRNO("gettimeofday", status); | ||||
TIMEVAL_TO_TIMESPEC(&tval, &__kmp_sys_timer_data.start); | TIMEVAL_TO_TIMESPEC(&tval, &__kmp_sys_timer_data.start); | ||||
} | } | ||||
#ifdef BUILD_TV | |||||
void __kmp_tv_threadprivate_store(kmp_info_t *th, void *global_addr, | |||||
void *thread_addr) { | |||||
struct tv_data *p; | |||||
p = (struct tv_data *)__kmp_allocate(sizeof(*p)); | |||||
p->u.tp.global_addr = global_addr; | |||||
p->u.tp.thread_addr = thread_addr; | |||||
p->type = (void *)1; | |||||
p->next = th->th.th_local.tv_data; | |||||
th->th.th_local.tv_data = p; | |||||
if (p->next == 0) { | |||||
int rc = pthread_setspecific(__kmp_tv_key, p); | |||||
KMP_CHECK_SYSFAIL("pthread_setspecific", rc); | |||||
} | |||||
} | |||||
#endif /* BUILD_TV */ | |||||
static int __kmp_get_xproc(void) { | static int __kmp_get_xproc(void) { | ||||
int r = 0; | int r = 0; | ||||
#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD | #if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD | ||||
r = sysconf(_SC_NPROCESSORS_ONLN); | r = sysconf(_SC_NPROCESSORS_ONLN); | ||||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | if (sysconf(_SC_THREADS)) { | ||||
if (__kmp_sys_min_stksize <= 1) { | if (__kmp_sys_min_stksize <= 1) { | ||||
__kmp_sys_min_stksize = KMP_MIN_STKSIZE; | __kmp_sys_min_stksize = KMP_MIN_STKSIZE; | ||||
} | } | ||||
} | } | ||||
/* Set up minimum number of threads to switch to TLS gtid */ | /* Set up minimum number of threads to switch to TLS gtid */ | ||||
__kmp_tls_gtid_min = KMP_TLS_GTID_MIN; | __kmp_tls_gtid_min = KMP_TLS_GTID_MIN; | ||||
#ifdef BUILD_TV | |||||
{ | |||||
int rc = pthread_key_create(&__kmp_tv_key, 0); | |||||
KMP_CHECK_SYSFAIL("pthread_key_create", rc); | |||||
} | |||||
#endif | |||||
status = pthread_key_create(&__kmp_gtid_threadprivate_key, | status = pthread_key_create(&__kmp_gtid_threadprivate_key, | ||||
__kmp_internal_end_dest); | __kmp_internal_end_dest); | ||||
KMP_CHECK_SYSFAIL("pthread_key_create", status); | KMP_CHECK_SYSFAIL("pthread_key_create", status); | ||||
status = pthread_mutexattr_init(&mutex_attr); | status = pthread_mutexattr_init(&mutex_attr); | ||||
KMP_CHECK_SYSFAIL("pthread_mutexattr_init", status); | KMP_CHECK_SYSFAIL("pthread_mutexattr_init", status); | ||||
status = pthread_mutex_init(&__kmp_wait_mx.m_mutex, &mutex_attr); | status = pthread_mutex_init(&__kmp_wait_mx.m_mutex, &mutex_attr); | ||||
KMP_CHECK_SYSFAIL("pthread_mutex_init", status); | KMP_CHECK_SYSFAIL("pthread_mutex_init", status); | ||||
status = pthread_condattr_init(&cond_attr); | status = pthread_condattr_init(&cond_attr); | ||||
Show All 15 Lines | void __kmp_runtime_destroy(void) { | ||||
}; | }; | ||||
#if USE_ITT_BUILD | #if USE_ITT_BUILD | ||||
__kmp_itt_destroy(); | __kmp_itt_destroy(); | ||||
#endif /* USE_ITT_BUILD */ | #endif /* USE_ITT_BUILD */ | ||||
status = pthread_key_delete(__kmp_gtid_threadprivate_key); | status = pthread_key_delete(__kmp_gtid_threadprivate_key); | ||||
KMP_CHECK_SYSFAIL("pthread_key_delete", status); | KMP_CHECK_SYSFAIL("pthread_key_delete", status); | ||||
#ifdef BUILD_TV | |||||
status = pthread_key_delete(__kmp_tv_key); | |||||
KMP_CHECK_SYSFAIL("pthread_key_delete", status); | |||||
#endif | |||||
status = pthread_mutex_destroy(&__kmp_wait_mx.m_mutex); | status = pthread_mutex_destroy(&__kmp_wait_mx.m_mutex); | ||||
if (status != 0 && status != EBUSY) { | if (status != 0 && status != EBUSY) { | ||||
KMP_SYSFAIL("pthread_mutex_destroy", status); | KMP_SYSFAIL("pthread_mutex_destroy", status); | ||||
} | } | ||||
status = pthread_cond_destroy(&__kmp_wait_cv.c_cond); | status = pthread_cond_destroy(&__kmp_wait_cv.c_cond); | ||||
if (status != 0 && status != EBUSY) { | if (status != 0 && status != EBUSY) { | ||||
KMP_SYSFAIL("pthread_cond_destroy", status); | KMP_SYSFAIL("pthread_cond_destroy", status); | ||||
▲ Show 20 Lines • Show All 488 Lines • Show Last 20 Lines |