# HG changeset patch # User mbaesken # Date 1545321655 -3600 # Thu Dec 20 17:00:55 2018 +0100 # Node ID 8928b0393306e7fe722af7dfde1c287527f2c206 # Parent dd5d7ba5b539eada7cb6389815b0e13139c96790 8215707: [macosx] check return code of pthread_getschedparam diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -2346,14 +2346,13 @@ #elif defined(__APPLE__) || defined(__NetBSD__) struct sched_param sp; int policy; - pthread_t self = pthread_self(); - - if (pthread_getschedparam(self, &policy, &sp) != 0) { + + if (pthread_getschedparam(thread->osthread()->pthread_id(), &policy, &sp) != 0) { return OS_ERR; } sp.sched_priority = newpri; - if (pthread_setschedparam(self, policy, &sp) != 0) { + if (pthread_setschedparam(thread->osthread()->pthread_id(), policy, &sp) != 0) { return OS_ERR; } @@ -2377,8 +2376,14 @@ int policy; struct sched_param sp; - pthread_getschedparam(pthread_self(), &policy, &sp); - *priority_ptr = sp.sched_priority; + 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