FreeBSD thread priorities



For some reason the pthread thread priorities don't take the POSIX_ defines
on FreeBSD and a different set of values are used.  This patch fixes the
thread priorities for FreeBSD.

Index: gthread-posix.c
===================================================================
RCS file: /cvs/gnome/glib/gthread/gthread-posix.c,v
retrieving revision 1.26
diff -u -r1.26 gthread-posix.c
--- gthread-posix.c 2001/02/15 16:43:02 1.26
+++ gthread-posix.c 2001/03/19 22:46:43
@@ -97,8 +97,18 @@

 #if defined (POSIX_MIN_PRIORITY) && defined (POSIX_MAX_PRIORITY)
 # define HAVE_PRIORITIES 1
-# define PRIORITY_LOW_VALUE POSIX_MIN_PRIORITY
-# define PRIORITY_URGENT_VALUE POSIX_MAX_PRIORITY
+# ifndef __FreeBSD__
+#  define PRIORITY_LOW_VALUE POSIX_MIN_PRIORITY
+#  define PRIORITY_URGENT_VALUE POSIX_MAX_PRIORITY
+# else /* __FreeBSD__ */
+   /* FreeBSD threads use different priority values from the
+    * POSIX_ defines so we just set them here.
+    */
+#  define PRIORITY_LOW_VALUE      0
+#  define PRIORITY_NORMAL_VALUE   15
+#  define PRIORITY_HIGH_VALUE     19 /* garbage collector is 20 */
+#  define PRIORITY_URGENT_VALUE   31
+# endif /* __FreeBSD__ */
 #endif /* POSIX_MIN_PRIORITY && POSIX_MAX_PRIORITY */

 static gulong g_thread_min_stack_size = 0;







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]