diff options
author | Jon Santmyer <jon@jonsantmyer.com> | 2024-05-22 13:00:41 -0400 |
---|---|---|
committer | Jon Santmyer <jon@jonsantmyer.com> | 2024-05-22 13:00:41 -0400 |
commit | ace65b453151845bc361f21f3e5b651c35f9f126 (patch) | |
tree | 262ebd29b0ca1d8584f0b6f1efa7a00d9f4f3e43 /lib/spinlock.h | |
parent | f004c1ade8d617a82cea2fe249434cccb47a2358 (diff) | |
download | jove-kernel-ace65b453151845bc361f21f3e5b651c35f9f126.tar.gz jove-kernel-ace65b453151845bc361f21f3e5b651c35f9f126.tar.bz2 jove-kernel-ace65b453151845bc361f21f3e5b651c35f9f126.zip |
Diffstat (limited to 'lib/spinlock.h')
-rw-r--r-- | lib/spinlock.h | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/lib/spinlock.h b/lib/spinlock.h deleted file mode 100644 index 75af28a..0000000 --- a/lib/spinlock.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef JOVE_LIB_SPINLOCK_H -#define JOVE_LIB_SPINLOCK_H 1 - -#include <stdatomic.h> - -typedef struct Spinlock -{ - atomic_flag flg; - - const char *locker_file; - const char *locker_func; - int locker_line; -} spinlock_t; - -#define spinlock_acquire(lock) \ - while(atomic_flag_test_and_set_explicit(&lock.flg, memory_order_acquire)) \ - __builtin_ia32_pause(); \ - lock.locker_file = __FILE__; \ - lock.locker_func = __FUNCTION__; \ - lock.locker_line = __LINE__ - -#define spinlock_release(lock) \ - atomic_flag_clear_explicit(&lock.flg, memory_order_release); \ - lock.locker_file = lock.locker_func = NULL; \ - lock.locker_line = -1 - -#endif |