< prev index next >

src/hotspot/os/bsd/os_bsd.cpp

Print this page
rev 53077 : 8215707: [macosx] check return code of pthread_getschedparam

*** 2344,2361 **** #elif defined(__FreeBSD__) int ret = pthread_setprio(thread->osthread()->pthread_id(), newpri); #elif defined(__APPLE__) || defined(__NetBSD__) struct sched_param sp; int policy; - pthread_t self = pthread_self(); ! if (pthread_getschedparam(self, &policy, &sp) != 0) { return OS_ERR; } sp.sched_priority = newpri; ! if (pthread_setschedparam(self, policy, &sp) != 0) { return OS_ERR; } return OS_OK; #else --- 2344,2360 ---- #elif defined(__FreeBSD__) int ret = pthread_setprio(thread->osthread()->pthread_id(), newpri); #elif defined(__APPLE__) || defined(__NetBSD__) struct sched_param sp; int policy; ! if (pthread_getschedparam(thread->osthread()->pthread_id(), &policy, &sp) != 0) { return OS_ERR; } sp.sched_priority = newpri; ! if (pthread_setschedparam(thread->osthread()->pthread_id(), policy, &sp) != 0) { return OS_ERR; } return OS_OK; #else
*** 2375,2386 **** *priority_ptr = pthread_getprio(thread->osthread()->pthread_id()); #elif defined(__APPLE__) || defined(__NetBSD__) int policy; struct sched_param sp; ! pthread_getschedparam(pthread_self(), &policy, &sp); *priority_ptr = sp.sched_priority; #else *priority_ptr = getpriority(PRIO_PROCESS, thread->osthread()->thread_id()); #endif return (*priority_ptr != -1 || errno == 0 ? OS_OK : OS_ERR); } --- 2374,2391 ---- *priority_ptr = pthread_getprio(thread->osthread()->pthread_id()); #elif defined(__APPLE__) || defined(__NetBSD__) int policy; struct sched_param sp; ! int res = pthread_getschedparam(thread->osthread()->pthread_id(), &policy, &sp); ! if (res != 0) { ! *priority_ptr = -1; ! return OS_ERR; ! } else { *priority_ptr = sp.sched_priority; + return OS_OK; + } #else *priority_ptr = getpriority(PRIO_PROCESS, thread->osthread()->thread_id()); #endif return (*priority_ptr != -1 || errno == 0 ? OS_OK : OS_ERR); }
< prev index next >