voron

experimental ARM OS
git clone git://git.2f30.org/voron
Log | Files | Refs | README | LICENSE

commit 7376a2f9beca5c6c6b5c912ae19d448d100b6ab3
parent 52248cc8fdfde5ed24e095b9a977e48df943972c
Author: oblique <psyberbits@gmail.com>
Date:   Mon,  1 Apr 2013 20:45:23 +0300

semaphore.h: fix mutex_unlock

Diffstat:
Minclude/semaphore.h | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/semaphore.h b/include/semaphore.h @@ -98,6 +98,13 @@ mutex_lock(mutex_t *mut) static inline void mutex_unlock(mutex_t *mut) { + spinlock_lock(&mut->sem.lock); + /* if it's already unlocked, do nothing */ + if (mut->sem.counter == 1) { + spinlock_unlock(&mut->sem.lock); + return; + } + spinlock_unlock(&mut->sem.lock); semaphore_done(&mut->sem); }