From 72cab5027f3b61424261a24ef96f0bc92fedd182 Mon Sep 17 00:00:00 2001 From: Sebastian Wilhelmi Date: Tue, 3 Apr 2001 12:49:44 +0000 Subject: [PATCH] Added special case for priorities on FreeBSD. Thanks to David Reid 2001-04-03 Sebastian Wilhelmi * gthread-posix.c: Added special case for priorities on FreeBSD. Thanks to David Reid for the info. * gthread-impl.c: Made two macros safe with (). --- gthread/ChangeLog | 7 +++++++ gthread/gthread-impl.c | 4 ++-- gthread/gthread-posix.c | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/gthread/ChangeLog b/gthread/ChangeLog index 7fae239..f28365c 100644 --- a/gthread/ChangeLog +++ b/gthread/ChangeLog @@ -1,3 +1,10 @@ +2001-04-03 Sebastian Wilhelmi + + * gthread-posix.c: Added special case for priorities on + FreeBSD. Thanks to David Reid for the info. + + * gthread-impl.c: Made two macros safe with (). + 2001-03-10 Tor Lillqvist * Makefile.am: Use the _LIBADD dependency on libglib only on diff --git a/gthread/gthread-impl.c b/gthread/gthread-impl.c index 01c682b..a00012c 100644 --- a/gthread/gthread-impl.c +++ b/gthread/gthread-impl.c @@ -52,12 +52,12 @@ static gint g_thread_priority_map [G_THREAD_PRIORITY_URGENT]; #ifndef PRIORITY_NORMAL_VALUE # define PRIORITY_NORMAL_VALUE \ - PRIORITY_LOW_VALUE + (PRIORITY_URGENT_VALUE - PRIORITY_LOW_VALUE) * 40 / 100 + (PRIORITY_LOW_VALUE + (PRIORITY_URGENT_VALUE - PRIORITY_LOW_VALUE) * 4 / 10) #endif /* PRIORITY_NORMAL_VALUE */ #ifndef PRIORITY_HIGH_VALUE # define PRIORITY_HIGH_VALUE \ - PRIORITY_LOW_VALUE + (PRIORITY_URGENT_VALUE - PRIORITY_LOW_VALUE) * 80 / 100 + (PRIORITY_LOW_VALUE + (PRIORITY_URGENT_VALUE - PRIORITY_LOW_VALUE) * 8 / 10) #endif /* PRIORITY_HIGH_VALUE */ void g_mutex_init (void); diff --git a/gthread/gthread-posix.c b/gthread/gthread-posix.c index 1b2cb81..74d563f 100644 --- a/gthread/gthread-posix.c +++ b/gthread/gthread-posix.c @@ -97,8 +97,18 @@ static gboolean posix_check_cmd_prio_warned = FALSE; #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 +# ifdef __FreeBSD__ + /* FreeBSD threads use different priority values from the POSIX_ + * defines so we just set them here. The corresponding macros + * PTHREAD_MIN_PRIORITY and PTHREAD_MAX_PRIORITY are implied to be + * exported by the docs, but they aren't. + */ +# define PRIORITY_LOW_VALUE 0 +# define PRIORITY_URGENT_VALUE 31 +# else /* !__FreeBSD__ */ +# define PRIORITY_LOW_VALUE POSIX_MIN_PRIORITY +# define PRIORITY_URGENT_VALUE POSIX_MAX_PRIORITY +# endif /* !__FreeBSD__ */ #endif /* POSIX_MIN_PRIORITY && POSIX_MAX_PRIORITY */ static gulong g_thread_min_stack_size = 0; -- 2.7.4