diff options
author | Landry Breuil <landry@openbsd.org> | 2014-12-15 15:18:21 -0500 |
---|---|---|
committer | Landry Breuil <landry@openbsd.org> | 2014-12-15 15:18:21 -0500 |
commit | 54a6f849c3dc89388a80c6969b1265b8863c382c (patch) | |
tree | b63aae51672b14d641ade9d8163935dd9de569aa | |
parent | b441324e74e676a52fa3ccc6445f25ee9b032825 (diff) | |
download | nspr-hg-NSPR_4_10_8_BETA2.tar.gz |
Bug 756047: check for _POSIX_THREAD_PRIORITY_SCHEDULING > 0 instead of only checking if the identifier is defined r=tedNSPR_4_10_8_BETA2
-rw-r--r-- | pr/src/pthreads/ptthread.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/pr/src/pthreads/ptthread.c b/pr/src/pthreads/ptthread.c index 4ab564a2..16d06f65 100644 --- a/pr/src/pthreads/ptthread.c +++ b/pr/src/pthreads/ptthread.c @@ -54,7 +54,7 @@ static struct _PT_Bookeeping pthread_key_t key; /* thread private data key */ PRBool keyCreated; /* whether 'key' should be deleted */ PRThread *first, *last; /* list of threads we know about */ -#if defined(_PR_DCETHREADS) || defined(_POSIX_THREAD_PRIORITY_SCHEDULING) +#if defined(_PR_DCETHREADS) || _POSIX_THREAD_PRIORITY_SCHEDULING > 0 PRInt32 minPrio, maxPrio; /* range of scheduling priorities */ #endif } pt_book = {0}; @@ -63,7 +63,7 @@ static void _pt_thread_death(void *arg); static void _pt_thread_death_internal(void *arg, PRBool callDestructors); static void init_pthread_gc_support(void); -#if defined(_PR_DCETHREADS) || defined(_POSIX_THREAD_PRIORITY_SCHEDULING) +#if defined(_PR_DCETHREADS) || _POSIX_THREAD_PRIORITY_SCHEDULING > 0 static PRIntn pt_PriorityMap(PRThreadPriority pri) { #ifdef NTO @@ -325,11 +325,11 @@ static PRThread* _PR_CreateThread( if (EPERM != pt_schedpriv) { -#if !defined(_PR_DCETHREADS) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) +#if !defined(_PR_DCETHREADS) && _POSIX_THREAD_PRIORITY_SCHEDULING > 0 struct sched_param schedule; #endif -#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) +#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0 rv = pthread_attr_setinheritsched(&tattr, PTHREAD_EXPLICIT_SCHED); PR_ASSERT(0 == rv); #endif @@ -339,7 +339,7 @@ static PRThread* _PR_CreateThread( #if defined(_PR_DCETHREADS) rv = pthread_attr_setprio(&tattr, pt_PriorityMap(priority)); PR_ASSERT(0 == rv); -#elif defined(_POSIX_THREAD_PRIORITY_SCHEDULING) +#elif _POSIX_THREAD_PRIORITY_SCHEDULING > 0 rv = pthread_attr_getschedparam(&tattr, &schedule); PR_ASSERT(0 == rv); schedule.sched_priority = pt_PriorityMap(priority); @@ -396,7 +396,7 @@ static PRThread* _PR_CreateThread( scope = PR_GLOBAL_THREAD; if (PR_GLOBAL_BOUND_THREAD == scope) { -#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) +#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0 rv = pthread_attr_setscope(&tattr, PTHREAD_SCOPE_SYSTEM); if (rv) { /* @@ -471,7 +471,7 @@ static PRThread* _PR_CreateThread( PR_LOG(_pr_thread_lm, PR_LOG_MIN, ("_PR_CreateThread: no thread scheduling privilege")); /* Try creating the thread again without setting priority. */ -#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) +#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0 rv = pthread_attr_setinheritsched(&tattr, PTHREAD_INHERIT_SCHED); PR_ASSERT(0 == rv); #endif @@ -692,7 +692,7 @@ PR_IMPLEMENT(void) PR_SetThreadPriority(PRThread *thred, PRThreadPriority newPri #if defined(_PR_DCETHREADS) rv = pthread_setprio(thred->id, pt_PriorityMap(newPri)); /* pthread_setprio returns the old priority */ -#elif defined(_POSIX_THREAD_PRIORITY_SCHEDULING) +#elif _POSIX_THREAD_PRIORITY_SCHEDULING > 0 if (EPERM != pt_schedpriv) { int policy; @@ -921,7 +921,7 @@ void _PR_InitThreads( pthread_init(); #endif -#if defined(_PR_DCETHREADS) || defined(_POSIX_THREAD_PRIORITY_SCHEDULING) +#if defined(_PR_DCETHREADS) || _POSIX_THREAD_PRIORITY_SCHEDULING > 0 #if defined(FREEBSD) { pthread_attr_t attr; |