Skip to content

Commit 986c3ad

Browse files
committed
fix: remove cas from park/unpark api
1 parent fa2e9ca commit 986c3ad

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

tarantool/src/cbus/sync/std.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,19 @@ impl Thread {
1919
fn current() -> Self {
2020
Self {
2121
inner: thread::current(),
22-
flag: Arc::new(AtomicBool::new(true)),
22+
flag: Arc::new(AtomicBool::new(false)),
2323
}
2424
}
2525

2626
fn park(&self) {
27-
if self
28-
.flag
29-
.compare_exchange(true, false, Ordering::AcqRel, Ordering::Acquire)
30-
.is_ok()
31-
{
27+
if !self.flag.load(Ordering::Acquire) {
3228
thread::park();
33-
};
29+
}
3430
}
3531

3632
fn unpark(&self) {
37-
if self
38-
.flag
39-
.compare_exchange(false, true, Ordering::AcqRel, Ordering::Acquire)
40-
.is_ok()
41-
{
42-
self.inner.unpark();
43-
};
33+
self.flag.store(true, Ordering::Release);
34+
self.inner.unpark();
4435
}
4536
}
4637

0 commit comments

Comments
 (0)