Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pthread_attr_{get,sed}schedparam and glib-2.18.x


I've found that glib's gthread code calls pthread_attr_getschedparam()
when creating new threads, and that it always returns ENOMEM.

After looking at NetBSD's libpthread it seems that you aren't allowed to
call _getschedparam() without first calling _setschedparam() which allocates
a pthread_attr_private structure that _getschedparam() needs access to.

My question is, is NetBSD's libpthread correct with this behaviour?
or should glib be fixed as I did with the following patch?

--- gthread/gthread-posix.c.orig        2008-10-10 07:22:09.000000000 +0200
+++ gthread/gthread-posix.c     2008-10-10 07:22:29.000000000 +0200
@@ -343,9 +343,9 @@ g_thread_create_posix_impl (GThreadFunc 
     struct sched_param sched;
-    posix_check_cmd (pthread_attr_getschedparam (&attr, &sched));
     sched.sched_priority = g_thread_priority_map [priority];
     posix_check_cmd_prio (pthread_attr_setschedparam (&attr, &sched));
+    posix_check_cmd (pthread_attr_getschedparam (&attr, &sched));
 # else /* G_THREADS_IMPL_DCE */

Home | Main Index | Thread Index | Old Index