From dffd0ee5d1bb64bc51ea5d11969a289a60abed63 Mon Sep 17 00:00:00 2001 From: mtm Date: Sun, 29 Jun 2003 00:12:40 +0000 Subject: The move to _retire() a thread in the GC instead of in the thread's exit function has invalidated the need for _spin[un]lock_pthread(). The _spin[un]lock() functions can now dereference curthread without the danger that the ldtentry containing the pointer to the thread has been cleared out from under them. --- lib/libthr/thread/thr_spinlock.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'lib/libthr/thread/thr_spinlock.c') diff --git a/lib/libthr/thread/thr_spinlock.c b/lib/libthr/thread/thr_spinlock.c index 0f9cb6b..53e9851 100644 --- a/lib/libthr/thread/thr_spinlock.c +++ b/lib/libthr/thread/thr_spinlock.c @@ -47,13 +47,7 @@ void _spinunlock(spinlock_t *lck) { - _spinunlock_pthread(curthread, lck); -} - -inline void -_spinunlock_pthread(pthread_t pthread, spinlock_t *lck) -{ - if (umtx_unlock((struct umtx *)lck, pthread->thr_id)) + if (umtx_unlock((struct umtx *)lck, curthread->thr_id)) abort(); } @@ -66,7 +60,8 @@ _spinunlock_pthread(pthread_t pthread, spinlock_t *lck) void _spinlock(spinlock_t *lck) { - _spinlock_pthread(curthread, lck); + if (umtx_lock((struct umtx *)lck, curthread->thr_id)) + abort(); } int @@ -79,13 +74,6 @@ _spintrylock(spinlock_t *lck) return (error); } -inline void -_spinlock_pthread(pthread_t pthread, spinlock_t *lck) -{ - if (umtx_lock((struct umtx *)lck, pthread->thr_id)) - abort(); -} - /* * Lock a location for the running thread. Yield to allow other * threads to run if this thread is blocked because the lock is -- cgit v1.1