diff options
author | davidxu <davidxu@FreeBSD.org> | 2006-04-27 08:18:23 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2006-04-27 08:18:23 +0000 |
commit | 66d0fee031ed44d54ee9e1a183fbe75c37a6e158 (patch) | |
tree | daa71c55e66d8720e95d00de6f5673a23b90bfa8 /lib/libthr/thread/thr_private.h | |
parent | e4cefd49df59b5e0ac6b8c1791cf554240bae189 (diff) | |
download | FreeBSD-src-66d0fee031ed44d54ee9e1a183fbe75c37a6e158.zip FreeBSD-src-66d0fee031ed44d54ee9e1a183fbe75c37a6e158.tar.gz |
- Use same priority range returned by kernel's sched_get_priority_min()
and sched_get_priority_max() syscalls.
- Remove unused fields from structure pthread_attr.
Diffstat (limited to 'lib/libthr/thread/thr_private.h')
-rw-r--r-- | lib/libthr/thread/thr_private.h | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h index bc91b94..9863a3b 100644 --- a/lib/libthr/thread/thr_private.h +++ b/lib/libthr/thread/thr_private.h @@ -232,12 +232,10 @@ struct pthread_atfork { struct pthread_attr { int sched_policy; int sched_inherit; - int sched_interval; int prio; int suspend; #define THR_STACK_USER 0x100 /* 0xFF reserved for <pthread.h> */ int flags; - void *arg_attr; void *stackaddr_attr; size_t stacksize_attr; size_t guardsize_attr; @@ -262,33 +260,26 @@ struct pthread_attr { #define THR_STACK_INITIAL (THR_STACK_DEFAULT * 2) /* - * Define the different priority ranges. All applications have thread - * priorities constrained within 0-31. The threads library raises the - * priority when delivering signals in order to ensure that signal - * delivery happens (from the POSIX spec) "as soon as possible". - * In the future, the threads library will also be able to map specific - * threads into real-time (cooperating) processes or kernel threads. - * The RT and SIGNAL priorities will be used internally and added to - * thread base priorities so that the scheduling queue can handle both - * normal and RT priority threads with and without signal handling. - * - * The approach taken is that, within each class, signal delivery - * always has priority over thread execution. - */ -#define THR_DEFAULT_PRIORITY 15 -#define THR_MIN_PRIORITY 0 -#define THR_MAX_PRIORITY 31 /* 0x1F */ -#define THR_SIGNAL_PRIORITY 32 /* 0x20 */ -#define THR_RT_PRIORITY 64 /* 0x40 */ -#define THR_FIRST_PRIORITY THR_MIN_PRIORITY -#define THR_LAST_PRIORITY \ - (THR_MAX_PRIORITY + THR_SIGNAL_PRIORITY + THR_RT_PRIORITY) -#define THR_BASE_PRIORITY(prio) ((prio) & THR_MAX_PRIORITY) - -/* - * Time slice period in microseconds. + * Define priorities returned by kernel. */ -#define TIMESLICE_USEC 20000 +#define THR_MIN_PRIORITY (_thr_priorities[SCHED_OTHER-1].pri_min) +#define THR_MAX_PRIORITY (_thr_priorities[SCHED_OTHER-1].pri_min) +#define THR_DEF_PRIORITY (_thr_priorities[SCHED_OTHER-1].pri_default) + +#define THR_MIN_RR_PRIORITY (_thr_priorities[SCHED_RR-1].pri_min) +#define THR_MAX_RR_PRIORITY (_thr_priorities[SCHED_RR-1].pri_max) +#define THR_DEF_RR_PRIORITY (_thr_priorities[SCHED_RR-1].pri_default) + +/* XXX The SCHED_FIFO should have same priority range as SCHED_RR */ +#define THR_MIN_FIFO_PRIORITY (_thr_priorities[SCHED_FIFO_1].pri_min) +#define THR_MAX_FIFO_PRIORITY (_thr_priorities[SCHED_FIFO-1].pri_min) +#define THR_DEF_FIFO_PRIORITY (_thr_priorities[SCHED_FIFO-1].pri_default) + +struct pthread_prio { + int pri_min; + int pri_max; + int pri_default; +}; struct pthread_rwlockattr { int pshared; @@ -622,6 +613,8 @@ extern struct pthread_mutex_attr _pthread_mutexattr_default __hidden; /* Default condition variable attributes: */ extern struct pthread_cond_attr _pthread_condattr_default __hidden; +extern struct pthread_prio _thr_priorities[] __hidden; + extern pid_t _thr_pid __hidden; extern size_t _thr_guard_default __hidden; extern size_t _thr_stack_default __hidden; |