diff options
author | davidxu <davidxu@FreeBSD.org> | 2006-03-27 23:50:21 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2006-03-27 23:50:21 +0000 |
commit | 255936645ee180cbe2421e975b37ca5a0b909f0d (patch) | |
tree | b9c60d754d927cc2bd40ebcb206e1e116909d312 /lib/libthr/thread/thr_mutexattr.c | |
parent | 6bf81397d76889cb68aea5b4919132591916e638 (diff) | |
download | FreeBSD-src-255936645ee180cbe2421e975b37ca5a0b909f0d.zip FreeBSD-src-255936645ee180cbe2421e975b37ca5a0b909f0d.tar.gz |
Remove priority mutex code because it does not work correctly,
to make it work, turnstile like mechanism to support priority
propagating and other realtime scheduling options in kernel
should be available to userland mutex, for the moment, I just
want to make libthr be simple and efficient thread library.
Discussed with: deischen, julian
Diffstat (limited to 'lib/libthr/thread/thr_mutexattr.c')
-rw-r--r-- | lib/libthr/thread/thr_mutexattr.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_mutexattr.c b/lib/libthr/thread/thr_mutexattr.c index ecfd1da..e60ec67 100644 --- a/lib/libthr/thread/thr_mutexattr.c +++ b/lib/libthr/thread/thr_mutexattr.c @@ -79,6 +79,10 @@ __weak_reference(_pthread_mutexattr_settype, pthread_mutexattr_settype); __weak_reference(_pthread_mutexattr_destroy, pthread_mutexattr_destroy); __weak_reference(_pthread_mutexattr_getpshared, pthread_mutexattr_getpshared); __weak_reference(_pthread_mutexattr_setpshared, pthread_mutexattr_setpshared); +__weak_reference(_pthread_mutexattr_getprotocol, pthread_mutexattr_getprotocol); +__weak_reference(_pthread_mutexattr_setprotocol, pthread_mutexattr_setprotocol); +__weak_reference(_pthread_mutexattr_getprioceiling, pthread_mutexattr_getprioceiling); +__weak_reference(_pthread_mutexattr_setprioceiling, pthread_mutexattr_setprioceiling); int _pthread_mutexattr_init(pthread_mutexattr_t *attr) @@ -193,3 +197,62 @@ _pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared) return (0); } + +int +_pthread_mutexattr_getprotocol(pthread_mutexattr_t *mattr, int *protocol) +{ + int ret = 0; + + if ((mattr == NULL) || (*mattr == NULL)) + ret = EINVAL; + else + *protocol = (*mattr)->m_protocol; + + return(ret); +} + +int +_pthread_mutexattr_setprotocol(pthread_mutexattr_t *mattr, int protocol) +{ + int ret = 0; + + if ((mattr == NULL) || (*mattr == NULL) || + (protocol < PTHREAD_PRIO_NONE) || (protocol > PTHREAD_PRIO_PROTECT)) + ret = EINVAL; + else { + (*mattr)->m_protocol = protocol; + (*mattr)->m_ceiling = THR_MAX_PRIORITY; + } + return(ret); +} + +int +_pthread_mutexattr_getprioceiling(pthread_mutexattr_t *mattr, int *prioceiling) +{ + int ret = 0; + + if ((mattr == NULL) || (*mattr == NULL)) + ret = EINVAL; + else if ((*mattr)->m_protocol != PTHREAD_PRIO_PROTECT) + ret = EINVAL; + else + *prioceiling = (*mattr)->m_ceiling; + + return(ret); +} + +int +_pthread_mutexattr_setprioceiling(pthread_mutexattr_t *mattr, int prioceiling) +{ + int ret = 0; + + if ((mattr == NULL) || (*mattr == NULL)) + ret = EINVAL; + else if ((*mattr)->m_protocol != PTHREAD_PRIO_PROTECT) + ret = EINVAL; + else + (*mattr)->m_ceiling = prioceiling; + + return(ret); +} + |