Skip to content

Commit

Permalink
Merge pull request #76 from qookei/spinlock-fix
Browse files Browse the repository at this point in the history
spinlock: Fix ticket_spinlock::is_locked check
  • Loading branch information
avdgrinten authored Nov 14, 2024
2 parents 805d23e + afcba6b commit 922d38d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/frg/spinlock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 922d38d

Please sign in to comment.