Added special case for priorities on FreeBSD. Thanks to David Reid

2001-04-03  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

	* gthread-posix.c: Added special case for priorities on
	  FreeBSD. Thanks to David Reid <dreid@jetnet.co.uk> for the info.

	* gthread-impl.c: Made two macros safe with ().
This commit is contained in:
Sebastian Wilhelmi 2001-04-03 12:49:44 +00:00 committed by Sebastian Wilhelmi
parent d8dd1ac152
commit 72cab5027f
3 changed files with 21 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2001-04-03 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gthread-posix.c: Added special case for priorities on
FreeBSD. Thanks to David Reid <dreid@jetnet.co.uk> for the info.
* gthread-impl.c: Made two macros safe with ().
2001-03-10 Tor Lillqvist <tml@iki.fi> 2001-03-10 Tor Lillqvist <tml@iki.fi>
* Makefile.am: Use the _LIBADD dependency on libglib only on * Makefile.am: Use the _LIBADD dependency on libglib only on

View File

@ -52,12 +52,12 @@ static gint g_thread_priority_map [G_THREAD_PRIORITY_URGENT];
#ifndef PRIORITY_NORMAL_VALUE #ifndef PRIORITY_NORMAL_VALUE
# define 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 */ #endif /* PRIORITY_NORMAL_VALUE */
#ifndef PRIORITY_HIGH_VALUE #ifndef PRIORITY_HIGH_VALUE
# define 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 */ #endif /* PRIORITY_HIGH_VALUE */
void g_mutex_init (void); void g_mutex_init (void);

View File

@ -97,8 +97,18 @@ static gboolean posix_check_cmd_prio_warned = FALSE;
#if defined (POSIX_MIN_PRIORITY) && defined (POSIX_MAX_PRIORITY) #if defined (POSIX_MIN_PRIORITY) && defined (POSIX_MAX_PRIORITY)
# define HAVE_PRIORITIES 1 # define HAVE_PRIORITIES 1
# 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_LOW_VALUE POSIX_MIN_PRIORITY
# define PRIORITY_URGENT_VALUE POSIX_MAX_PRIORITY # define PRIORITY_URGENT_VALUE POSIX_MAX_PRIORITY
# endif /* !__FreeBSD__ */
#endif /* POSIX_MIN_PRIORITY && POSIX_MAX_PRIORITY */ #endif /* POSIX_MIN_PRIORITY && POSIX_MAX_PRIORITY */
static gulong g_thread_min_stack_size = 0; static gulong g_thread_min_stack_size = 0;