8#ifndef SkSpinlock_DEFINED
9#define SkSpinlock_DEFINED
18 constexpr SkSpinlock() =
default;
22 if (fLocked.exchange(
true, std::memory_order_acquire)) {
24 this->contendedAcquire();
31 if (fLocked.exchange(
true, std::memory_order_acquire)) {
40 fLocked.store(
false, std::memory_order_release);
44 SK_API void contendedAcquire();
46 std::atomic<bool> fLocked{
false};
55 SkSpinlock& fSpinlock;
class SK_CAPABILITY("mutex") SkSpinlock
#define SK_SCOPED_CAPABILITY
#define SK_RELEASE_CAPABILITY(...)
#define SK_TRY_ACQUIRE(...)
~SkAutoSpinlock() SK_RELEASE_CAPABILITY()
SkAutoSpinlock(SkSpinlock &mutex) SK_ACQUIRE(mutex)