diff --git a/include/frg/spinlock.hpp b/include/frg/spinlock.hpp index 310486c..3680775 100644 --- a/include/frg/spinlock.hpp +++ b/include/frg/spinlock.hpp @@ -42,8 +42,8 @@ struct ticket_spinlock { } bool is_locked() { - return (__atomic_load_n(&serving_ticket_, __ATOMIC_RELAXED) + 1) - == __atomic_load_n(&next_ticket_, __ATOMIC_RELAXED); + return __atomic_load_n(&serving_ticket_, __ATOMIC_RELAXED) + < __atomic_load_n(&next_ticket_, __ATOMIC_RELAXED); } void unlock() {