diff options
author | wtc%netscape.com <devnull@localhost> | 2001-03-02 05:46:21 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2001-03-02 05:46:21 +0000 |
commit | 2283b233fb4a72630de3706a04b24f87b2fecf09 (patch) | |
tree | b51af6651e6289a4c1cdd29a8f8c43046cce6ab2 | |
parent | bae5af97923011582b0e7294d7c277e2912547a0 (diff) | |
download | nspr-hg-2283b233fb4a72630de3706a04b24f87b2fecf09.tar.gz |
Bugzilla bug #64278: call sched_get_priority_min/max to get the minimum
and maximum priorities of the default scheduling policy. Thanks to
Matt Beauregard <marauder@marauder.tm> for reporting this bug.
(NSPRPUB_CLIENT_BRANCH)
-rw-r--r-- | pr/src/pthreads/ptthread.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pr/src/pthreads/ptthread.c b/pr/src/pthreads/ptthread.c index 63a83dcd..68c959b9 100644 --- a/pr/src/pthreads/ptthread.c +++ b/pr/src/pthreads/ptthread.c @@ -806,12 +806,28 @@ void _PR_InitThreads( #endif #if defined(_PR_DCETHREADS) || defined(_POSIX_THREAD_PRIORITY_SCHEDULING) +#if defined(FREEBSD) + { + pthread_attr_t attr; + int policy; + /* get the min and max priorities of the default policy */ + pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_getschedpolicy(&attr, &policy); + pt_book.minPrio = sched_get_priority_min(policy); + PR_ASSERT(-1 != pt_book.minPrio); + pt_book.maxPrio = sched_get_priority_max(policy); + PR_ASSERT(-1 != pt_book.maxPrio); + pthread_attr_destroy(&attr); + } +#else /* ** These might be function evaluations */ pt_book.minPrio = PT_PRIO_MIN; pt_book.maxPrio = PT_PRIO_MAX; #endif +#endif PR_ASSERT(NULL == pt_book.ml); pt_book.ml = PR_NewLock(); |