diff options
author | davidxu <davidxu@FreeBSD.org> | 2008-04-02 04:32:31 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2008-04-02 04:32:31 +0000 |
commit | 8d50c29c72f3cdacd868fee77671679d0744ba77 (patch) | |
tree | c2f55cf93c8e37437d4fc69962ee6d0b1dc3d2a4 /lib/libthr/thread/thr_umtx.c | |
parent | f4f495d3edf2dd065b46365c44241432288def65 (diff) | |
download | FreeBSD-src-8d50c29c72f3cdacd868fee77671679d0744ba77.zip FreeBSD-src-8d50c29c72f3cdacd868fee77671679d0744ba77.tar.gz |
Replace userland rwlock with a pure kernel based rwlock, the new
implementation does not switch pointers when it resumes waiters.
Asked by: jeff
Diffstat (limited to 'lib/libthr/thread/thr_umtx.c')
-rw-r--r-- | lib/libthr/thread/thr_umtx.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_umtx.c b/lib/libthr/thread/thr_umtx.c index 058205b..d0a225d 100644 --- a/lib/libthr/thread/thr_umtx.c +++ b/lib/libthr/thread/thr_umtx.c @@ -159,3 +159,27 @@ _thr_ucond_broadcast(struct ucond *cv) return (0); return (errno); } + +int +__thr_rwlock_rdlock(struct urwlock *rwlock, int flags, struct timespec *tsp) +{ + if (_umtx_op(rwlock, UMTX_OP_RW_RDLOCK, flags, NULL, tsp) != -1) + return (0); + return (errno); +} + +int +__thr_rwlock_wrlock(struct urwlock *rwlock, struct timespec *tsp) +{ + if (_umtx_op(rwlock, UMTX_OP_RW_WRLOCK, 0, NULL, tsp) != -1) + return (0); + return (errno); +} + +int +__thr_rwlock_unlock(struct urwlock *rwlock) +{ + if (_umtx_op(rwlock, UMTX_OP_RW_UNLOCK, 0, NULL, NULL) != -1) + return (0); + return (errno); +} |