spinlock.h 445 B

123456789101112131415161718192021
  1. #pragma once
  2. #include <util/system/defaults.h>
  3. typedef volatile intptr_t spinlock_t;
  4. #define SPIN_L AllocAcquireAdaptiveLock
  5. #define SPIN_U AllocReleaseAdaptiveLock
  6. #define _SPINLOCK_INITIALIZER 0
  7. #define _SPINUNLOCK(_lck) SPIN_U(_lck)
  8. #define _SPINLOCK(_lck) SPIN_L(_lck)
  9. #if defined(__cplusplus)
  10. extern "C" {
  11. #endif
  12. void SPIN_L(spinlock_t* lock);
  13. void SPIN_U(spinlock_t* lock);
  14. #if defined(__cplusplus)
  15. };
  16. #endif