diff --git a/ylong_runtime/src/executor/queue.rs b/ylong_runtime/src/executor/queue.rs index e034acde645608cb4af81450325326d78fa5e4b1..22bb808e8e59944d0d6b7492b11670de10326de9 100644 --- a/ylong_runtime/src/executor/queue.rs +++ b/ylong_runtime/src/executor/queue.rs @@ -214,7 +214,7 @@ impl InnerBuffer { wrap(steal_pos, next_real) }; - let res = self.front.compare_exchange(head, next, AcqRel, Acquire); + let res = self.front.compare_exchange_weak(head, next, AcqRel, Acquire); match res { Ok(_) => break real_pos, Err(actual) => head = actual, @@ -365,7 +365,7 @@ impl InnerBuffer { let res = self .front - .compare_exchange(src_prev_front, src_next_front, AcqRel, Acquire); + .compare_exchange_weak(src_prev_front, src_next_front, AcqRel, Acquire); match res { Ok(_) => break n, Err(actual) => src_prev_front = actual, diff --git a/ylong_runtime/src/sync/mpsc/bounded/array.rs b/ylong_runtime/src/sync/mpsc/bounded/array.rs index 872969a5e258c6f9dc42eedb354c40a6452aa24e..feba4e4b8c514a2bc84ddf2560cdb923ab4a1455 100644 --- a/ylong_runtime/src/sync/mpsc/bounded/array.rs +++ b/ylong_runtime/src/sync/mpsc/bounded/array.rs @@ -87,7 +87,7 @@ impl Array { // Compare the index of the node with the tail to avoid senders in different // cycles writing data to the same point at the same time. if (tail >> INDEX_SHIFT) == node_index { - match self.tail.compare_exchange( + match self.tail.compare_exchange_weak( tail, tail.wrapping_add(1 << INDEX_SHIFT), AcqRel, diff --git a/ylong_runtime/src/sync/mpsc/unbounded/queue.rs b/ylong_runtime/src/sync/mpsc/unbounded/queue.rs index e44c122b36f8de836f1de82b3c464de6bd1b5ede..a21f369dfe07d2bd3ba879a2090c31a7145fb954 100644 --- a/ylong_runtime/src/sync/mpsc/unbounded/queue.rs +++ b/ylong_runtime/src/sync/mpsc/unbounded/queue.rs @@ -168,7 +168,7 @@ impl Queue { match self .tail .index - .compare_exchange(tail, tail + (1 << INDEX_SHIFT), AcqRel, Acquire) + .compare_exchange_weak(tail, tail + (1 << INDEX_SHIFT), AcqRel, Acquire) { Ok(_) => { self.send_inner(index, block, new_block, value); diff --git a/ylong_runtime/src/sync/oneshot.rs b/ylong_runtime/src/sync/oneshot.rs index f84c378480d888d03addd6231d5153c2a2d7cacc..5700afbf84176e9c289706819342091296944121 100644 --- a/ylong_runtime/src/sync/oneshot.rs +++ b/ylong_runtime/src/sync/oneshot.rs @@ -171,7 +171,7 @@ impl Sender { if self .channel .state - .compare_exchange(INIT, SENT, AcqRel, Acquire) + .compare_exchange_weak(INIT, SENT, AcqRel, Acquire) .is_ok() { self.channel.waker.wake(); diff --git a/ylong_runtime/src/sync/rwlock.rs b/ylong_runtime/src/sync/rwlock.rs index 658849f1ea4edde5ac7d1e2d867b6f630526b852..4d0212a0db89cde728aedd65677132d17f427bff 100644 --- a/ylong_runtime/src/sync/rwlock.rs +++ b/ylong_runtime/src/sync/rwlock.rs @@ -141,7 +141,7 @@ impl RwLock { } match self .read_count - .compare_exchange(read_count, read_count + 1, AcqRel, Acquire) + .compare_exchange_weak(read_count, read_count + 1, AcqRel, Acquire) { Ok(_) => return Ok(RwLockReadGuard(self)), Err(curr) => read_count = curr,