fn pthread_spin_lock(s: *c.pthread_spinlock_t) callconv(.c) c_int
fn pthread_spin_lock(s: *c.pthread_spinlock_t) callconv(.c) c_int { const spin: *SpinLock = @ptrCast(s); if (builtin.single_threaded and @atomicLoad(SpinLock, spin, .monotonic) == .locked) return @backingInt(c.E.DEADLK); while (@cmpxchgWeak(SpinLock, spin, .unlocked, .locked, .acquire, .monotonic)) |_| { std.atomic.spinLoopHint(); } return 0; }