Opened 5 years ago

Closed 5 years ago

#13299 closed bug (fixed)

pthread_setschedparam should return 0 on success (easy)

Reported by: korli Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/POSIX Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All


set_thread_priority() returns the previous priority on success, our implementation of pthread_setschedparam() returns this value on success instead of zero.

Reference: excerpt from

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, &param);
+#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) {
 	if (res != 0) {
 		if (res == EPERM) {
 			g_warning ("%s: pthread_setschedparam failed, error: \"%s\" (%d)", __func__, g_strerror (res), res);
On Haiku, pthread_setschedparam returns a positive number that represents the priority - this is different than most OSes.

Change History (1)

comment:1 by korli, 5 years ago

Resolution: fixed
Status: newclosed

Fixed in hrev50954.

Note: See TracTickets for help on using tickets.