--- old/src/os/bsd/vm/osThread_bsd.cpp 2015-08-12 14:09:06.000000000 +0200 +++ new/src/os/bsd/vm/osThread_bsd.cpp 2015-08-12 14:09:06.000000000 +0200 @@ -51,3 +51,28 @@ void OSThread::pd_destroy() { delete _startThread_lock; } + +bool OSThread::is_online() { +#ifdef __APPLE__ + mach_msg_type_number_t thread_info_count = THREAD_BASIC_INFO_COUNT; + thread_basic_info_data_t thread_info_data; + + kern_return_t kr = thread_info( + _thread_id, + THREAD_BASIC_INFO, + reinterpret_cast(&thread_info_data), + &thread_info_count); + if (kr != KERN_SUCCESS) { + return false; + } + + if (thread_info_data.run_state != TH_STATE_RUNNING) return false; + + const bool swapped = (thread_info_data.flags & TH_FLAGS_SWAPPED); + const bool idle = (thread_info_data.flags & TH_FLAGS_IDLE); + + return !swapped && !idle; +#else + return true; +#endif +}