diff options
author | bje <bje> | 1998-07-23 15:27:26 +0000 |
---|---|---|
committer | bje <bje> | 1998-07-23 15:27:26 +0000 |
commit | 08445aa412d4399ca41da50082bcfe82a0e179a4 (patch) | |
tree | effa7525cd237ad9c17675a91d7160de105c129b /pthread.h | |
parent | 17c1d029397de6a700ea98df8650f4b0982af8b4 (diff) |
1998-07-24 Ben Elliston <bje@cygnus.com>
* pthread.h (sched_param): Define this type.
(pthread_attr_getschedparam): Add function prototype.
(pthread_attr_setschedparam): Likewise.
(pthread_setcancelstate): Likewise.
(pthread_setcanceltype): Likewise.
(sched_get_priority_min): Likewise.
(sched_get_priority_max): Likewise.
(pthread_mutexattr_setprotocol): Remove; not supported.
(pthread_mutexattr_getprotocol): Likewise.
(pthread_mutexattr_setprioceiling): Likewise.
(pthread_mutexattr_getprioceiling): Likewise.
(pthread_attr_t): Add canceltype member. Update comments.
(SCHED_OTHER): Define this scheduling policy constant.
(SCHED_FIFO): Likewise.
(SCHED_RR): Likewise.
(SCHED_MIN): Define the lowest possible value for this constant.
(SCHED_MAX): Likewise, the maximum possible value.
(PTHREAD_CANCEL_ASYNCHRONOUS): Redefine.
(PTHREAD_CANCEL_DEFERRED): Likewise.
Diffstat (limited to 'pthread.h')
-rw-r--r-- | pthread.h | 69 |
1 files changed, 47 insertions, 22 deletions
@@ -31,13 +31,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #undef _POSIX_THREAD_ATTR_STACKADDR #endif +/* Thread scheduling policies */ + +#define SCHED_OTHER 0 +#define SCHED_FIFO 1 +#define SCHED_RR 2 + +#define SCHED_MIN SCHED_OTHER +#define SCHED_MAX SCHED_RR /* Cancelability attributes */ #define PTHREAD_CANCEL_ENABLE 0x00 #define PTHREAD_CANCEL_DISABLE 0x01 -#define PTHREAD_CANCEL_ASYNCHRONOUS 0x02 -#define PTHREAD_CANCEL_DEFERRED 0x04 +#define PTHREAD_CANCEL_ASYNCHRONOUS 0x00 +#define PTHREAD_CANCEL_DEFERRED 0x01 typedef HANDLE pthread_t; typedef CRITICAL_SECTION pthread_mutex_t; @@ -51,12 +59,21 @@ typedef struct { size_t stacksize; /* PTHREAD_STACK_MIN */ #endif int cancelability; /* PTHREAD_CANCEL_DISABLE - PTHREAD_CANCEL_ENABLE - PTHREAD_CANCEL_ASYNCHRONOUS - PTHREAD_CANCEL_DEFERRED - _PTHREAD_CANCEL_DEFAULTS */ + PTHREAD_CANCEL_ENABLE */ + + int canceltype; /* PTHREAD_CANCEL_ASYNCHRONOUS + PTHREAD_CANCEL_DEFERRED */ + + int priority; } pthread_attr_t; +/* I don't know why this structure isn't in some kind of namespace. + According to my O'Reilly book, this is what this struct is + called. */ +struct sched_param { + int sched_priority; +} + typedef struct { enum { SIGNAL, BROADCAST, NUM_EVENTS }; @@ -119,6 +136,30 @@ int pthread_attr_setstackaddr(pthread_attr_t *attr, int pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr); +int pthread_attr_getschedparam(const pthread_attr_t *attr, + struct sched_param *param); + +int pthread_attr_setschedparam(pthread_attr_t *attr, + const struct sched_param *param); + +int pthread_setschedparam(pthread_t thread, + int policy, + const struct sched_param *param); + +int pthread_getschedparam(pthread_t thread, + int *policy, + struct sched_param *param); + +int sched_get_priority_min(int policy); + +int sched_get_priority_max(int policy); + +int pthread_setcancelstate(int state, + int *oldstate); + +int pthread_setcanceltype(int type, + int *oldtype); + /* Functions for manipulating cond. var. attribute objects. */ int pthread_condattr_init(pthread_condattr_t *attr); @@ -174,22 +215,6 @@ int pthread_mutex_trylock(pthread_mutex_t *mutex); int pthread_mutex_unlock(pthread_mutex_t *mutex); -/* These functions cannot be implemented in terms of the Win32 API. - Fortunately they are optional. Their implementation just returns - the correct error number. */ - -int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, - int protocol); - -int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr, - int *protocol); - -int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr, - int prioceiling); - -int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *attr, - int *ceiling); - /* Primitives for thread-specific data (TSD). */ int pthread_key_create(pthread_key_t *key, |