ck_spinlock: Acquire semantics for old locked operations.

Even though the intended use-case is for testing, developers
may want correctness guarantees in other situations.
ck_pring
Samy Al Bahra 12 years ago
parent 143bc4b336
commit 64b1201dcc

@ -213,6 +213,7 @@ CK_CC_INLINE static bool
ck_spinlock_fas_locked(struct ck_spinlock_fas *lock) ck_spinlock_fas_locked(struct ck_spinlock_fas *lock)
{ {
ck_pr_fence_load();
return ck_pr_load_uint(&lock->value); return ck_pr_load_uint(&lock->value);
} }
@ -287,6 +288,7 @@ CK_CC_INLINE static bool
ck_spinlock_cas_locked(struct ck_spinlock_cas *lock) ck_spinlock_cas_locked(struct ck_spinlock_cas *lock)
{ {
ck_pr_fence_load();
return ck_pr_load_uint(&lock->value); return ck_pr_load_uint(&lock->value);
} }
@ -358,6 +360,7 @@ CK_CC_INLINE static bool
ck_spinlock_dec_locked(struct ck_spinlock_dec *lock) ck_spinlock_dec_locked(struct ck_spinlock_dec *lock)
{ {
ck_pr_fence_load();
return ck_pr_load_uint(&lock->value) != 1; return ck_pr_load_uint(&lock->value) != 1;
} }
@ -710,6 +713,7 @@ CK_CC_INLINE static bool
ck_spinlock_mcs_locked(struct ck_spinlock_mcs **queue) ck_spinlock_mcs_locked(struct ck_spinlock_mcs **queue)
{ {
ck_pr_fence_load();
return ck_pr_load_ptr(queue) != NULL; return ck_pr_load_ptr(queue) != NULL;
} }

Loading…
Cancel
Save