RFR [XS] : 8215707: [macosx] check return code of pthread_getschedparam
Baesken, Matthias
matthias.baesken at sap.com
Thu Dec 20 09:21:53 UTC 2018
Hello, while looking at the thread prio + scheduling handling in hotspot, I noticed that at one place we seem to handle pthread_getschedparam in a wrong way.
According to the API documentation, pthread_getschedparam returns an int which is 0 when successful, otherwise it is a value != 0.
See
https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/pthread_setschedparam.3.html
"If successful, these functions return 0. Otherwise, an error number is returned to indicate the error."
At some places the return code of pthread_getschedparam is checked in the OpenJDK hotspot sources, however at os::get_native_priority (os_bsd.cpp) it is not done, but should be added.
The current coding handles the function in a getpriority-like way (which might or might not work), but at least it is not what is documented in the API doc and done at other places in the coding.
Bug/webrev :
https://bugs.openjdk.java.net/browse/JDK-8215707
http://cr.openjdk.java.net/~mbaesken/webrevs/8215707.0/
Thanks, Matthias
More information about the hotspot-dev
mailing list