diff options
Diffstat (limited to 'kernel/task/include/task/lock.h')
-rw-r--r-- | kernel/task/include/task/lock.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/task/include/task/lock.h b/kernel/task/include/task/lock.h index bfb7994..eaa661c 100644 --- a/kernel/task/include/task/lock.h +++ b/kernel/task/include/task/lock.h @@ -9,11 +9,15 @@ typedef char spin_lock_t; static inline void spin_lock(struct spin_lock_t* lock) { while(*lock != SPIN_LOCK_UNLOCKED) {yield();}; + cli(); *lock = 1; + sei(); } static inline void spin_unlock(struct spin_lock_t* lock) { + cli(); *lock = SPIN_LOCK_UNLOCKED; + sei(); } #endif
\ No newline at end of file |