ulib Remove sync
This commit is contained in:
@ -10,7 +10,6 @@ SRCFILES := $(call GRABSRC, \
|
|||||||
string \
|
string \
|
||||||
system \
|
system \
|
||||||
printf \
|
printf \
|
||||||
sync \
|
|
||||||
args \
|
args \
|
||||||
util \
|
util \
|
||||||
ubsan \
|
ubsan \
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
#include <stdatomic.h>
|
|
||||||
#include <sync/spinlock.h>
|
|
||||||
|
|
||||||
#define HINT() asm volatile("pause");
|
|
||||||
|
|
||||||
void spinlock_init(SpinLock *sl) {
|
|
||||||
atomic_store(&sl->lock, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void spinlock_acquire(SpinLock *sl) {
|
|
||||||
while (atomic_test_and_set_explicit(&sl->lock, memory_order_release)) {
|
|
||||||
HINT();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void spinlock_release(SpinLock *sl) {
|
|
||||||
atomic_clear_flag_explicit(&sl->lock, memory_order_release);
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
#ifndef ULIB_SYNC_SPINLOCK_H_
|
|
||||||
#define ULIB_SYNC_SPINLOCK_H_
|
|
||||||
|
|
||||||
#include <stdatomic.h>
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
atomic_bool lock;
|
|
||||||
} SpinLock;
|
|
||||||
|
|
||||||
void spinlock_init(SpinLock *sl);
|
|
||||||
void spinlock_acquire(SpinLock *sl);
|
|
||||||
void spinlock_release(SpinLock *sl);
|
|
||||||
|
|
||||||
#endif // ULIB_SYNC_SPINLOCK_H_
|
|
||||||
@ -7,7 +7,6 @@
|
|||||||
#include <string/stringbuffer.h>
|
#include <string/stringbuffer.h>
|
||||||
#include <string/conv.h>
|
#include <string/conv.h>
|
||||||
#include <string/char.h>
|
#include <string/char.h>
|
||||||
#include <sync/spinlock.h>
|
|
||||||
#include <syscall/syscall.h>
|
#include <syscall/syscall.h>
|
||||||
#include <system/system.h>
|
#include <system/system.h>
|
||||||
#include <util/util.h>
|
#include <util/util.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user