src/os/bsd/vm/os_bsd.cpp

Print this page
rev 3111 : imported patch osx-threadid

*** 977,988 **** sync->notify_all(); return NULL; } #ifdef _ALLBSD_SOURCE ! // thread_id is pthread_id on BSD ! osthread->set_thread_id(::pthread_self()); #else // thread_id is kernel thread id (similar to Solaris LWP id) osthread->set_thread_id(os::Bsd::gettid()); if (UseNUMA) { --- 977,988 ---- sync->notify_all(); return NULL; } #ifdef _ALLBSD_SOURCE ! // thread_id is mach thread on BSD ! osthread->set_thread_id(::mach_thread_self()); #else // thread_id is kernel thread id (similar to Solaris LWP id) osthread->set_thread_id(os::Bsd::gettid()); if (UseNUMA) {
*** 1169,1179 **** return false; } // Store pthread info into the OSThread #ifdef _ALLBSD_SOURCE ! osthread->set_thread_id(::pthread_self()); #else osthread->set_thread_id(os::Bsd::gettid()); #endif osthread->set_pthread_id(::pthread_self()); --- 1169,1179 ---- return false; } // Store pthread info into the OSThread #ifdef _ALLBSD_SOURCE ! osthread->set_thread_id(::mach_thread_self()); #else osthread->set_thread_id(os::Bsd::gettid()); #endif osthread->set_pthread_id(::pthread_self());
*** 1786,1796 **** ::strncpy(buf, s, n); buf[n] = '\0'; return n; } ! intx os::current_thread_id() { return (intx)pthread_self(); } int os::current_process_id() { // Under the old bsd thread library, bsd gives each thread // its own process id. Because of this each thread will return // a different pid if this method were to return the result --- 1786,1796 ---- ::strncpy(buf, s, n); buf[n] = '\0'; return n; } ! intx os::current_thread_id() { return (intx)::mach_thread_self(); } int os::current_process_id() { // Under the old bsd thread library, bsd gives each thread // its own process id. Because of this each thread will return // a different pid if this method were to return the result
*** 5131,5143 **** jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { #ifdef __APPLE__ struct thread_basic_info tinfo; mach_msg_type_number_t tcount = THREAD_INFO_MAX; kern_return_t kr; ! mach_port_t mach_thread; ! mach_thread = pthread_mach_thread_np(thread->osthread()->thread_id()); kr = thread_info(mach_thread, THREAD_BASIC_INFO, (thread_info_t)&tinfo, &tcount); if (kr != KERN_SUCCESS) return -1; if (user_sys_cpu_time) { --- 5131,5143 ---- jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { #ifdef __APPLE__ struct thread_basic_info tinfo; mach_msg_type_number_t tcount = THREAD_INFO_MAX; kern_return_t kr; ! thread_t mach_thread; ! mach_thread = thread->osthread()->thread_id(); kr = thread_info(mach_thread, THREAD_BASIC_INFO, (thread_info_t)&tinfo, &tcount); if (kr != KERN_SUCCESS) return -1; if (user_sys_cpu_time) {