lib: move lock/atomic into lib folder

This commit is contained in:
Michael Shaw 2024-03-19 00:19:42 -04:00
commit e4116bd3e8
2 changed files with 0 additions and 0 deletions

13
lib/lock.c Normal file
View file

@ -0,0 +1,13 @@
#include <kernel/common.h>
#include <kernel/lock.h>
void spinlock_acquire(spinlock_t *lock)
{
while (atomic_cmpxchg(lock, 0, 1))
;
}
void spinlock_release(spinlock_t *lock)
{
atomic_cmpxchg(lock, 1, 0);
}