#13299: pthread_setschedparam should return 0 on success (easy)
--------------------------+------------------------------
Reporter: korli | Owner: nobody
Type: bug | Status: new
Priority: normal | Milestone: Unscheduled
Component: System/POSIX | Version: R1/Development
Keywords: | Blocked By:
Blocking: | Has a Patch: 0
Platform: All |
--------------------------+------------------------------
set_thread_priority() returns the previous priority on success, our
implementation of pthread_setschedparam() returns this value on success
instead of zero.
http://cgit.haiku-
os.org/haiku/tree/src/system/libroot/posix/pthread/pthread.cpp#n294
http://cgit.haiku-
os.org/haiku/tree/src/system/kernel/scheduler/scheduler.cpp#n216
Reference: excerpt from http://minisoc.xyz/HaikuMono/
{{{
diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c
index 99206e6..ef1077c 100644
--- a/mono/metadata/threads.c
+++ b/mono/metadata/threads.c
@@ -642,7 +642,13 @@ mono_thread_internal_set_priority (MonoInternalThread
*internal, MonoThreadPrior
}
res = pthread_setschedparam (tid, policy, ¶m);
+#if defined(__HAIKU__)
+ /* On Haiku, pthread_setschedparam returns a positive number on
success,
+ which is the priority, or a negative number, which is the
errno. */
+ if (res < 0) {
+#else
if (res != 0) {
+#endif
if (res == EPERM) {
g_warning ("%s: pthread_setschedparam failed,
error: \"%s\" (%d)", __func__, g_strerror (res), res);
return;
On Haiku, pthread_setschedparam returns a positive number that represents
the priority - this is different than most OSes.
}}}
--
Ticket URL: <https://dev.haiku-os.org/ticket/13299>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.