mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
runtime: use compare_exchange_weak() in worker queue (#8028)
This commit is contained in:
@@ -298,7 +298,7 @@ impl<T> Local<T> {
|
|||||||
if self
|
if self
|
||||||
.inner
|
.inner
|
||||||
.head
|
.head
|
||||||
.compare_exchange(
|
.compare_exchange_weak(
|
||||||
prev,
|
prev,
|
||||||
pack(
|
pack(
|
||||||
head.wrapping_add(NUM_TASKS_TAKEN),
|
head.wrapping_add(NUM_TASKS_TAKEN),
|
||||||
@@ -387,7 +387,7 @@ impl<T> Local<T> {
|
|||||||
let res = self
|
let res = self
|
||||||
.inner
|
.inner
|
||||||
.head
|
.head
|
||||||
.compare_exchange(head, next, AcqRel, Acquire);
|
.compare_exchange_weak(head, next, AcqRel, Acquire);
|
||||||
|
|
||||||
match res {
|
match res {
|
||||||
Ok(_) => break real as usize & MASK,
|
Ok(_) => break real as usize & MASK,
|
||||||
@@ -523,7 +523,7 @@ impl<T> Steal<T> {
|
|||||||
let res = self
|
let res = self
|
||||||
.0
|
.0
|
||||||
.head
|
.head
|
||||||
.compare_exchange(prev_packed, next_packed, AcqRel, Acquire);
|
.compare_exchange_weak(prev_packed, next_packed, AcqRel, Acquire);
|
||||||
|
|
||||||
match res {
|
match res {
|
||||||
Ok(_) => break n,
|
Ok(_) => break n,
|
||||||
@@ -572,17 +572,11 @@ impl<T> Steal<T> {
|
|||||||
let res = self
|
let res = self
|
||||||
.0
|
.0
|
||||||
.head
|
.head
|
||||||
.compare_exchange(prev_packed, next_packed, AcqRel, Acquire);
|
.compare_exchange_weak(prev_packed, next_packed, AcqRel, Acquire);
|
||||||
|
|
||||||
match res {
|
match res {
|
||||||
Ok(_) => return n,
|
Ok(_) => return n,
|
||||||
Err(actual) => {
|
Err(actual) => prev_packed = actual,
|
||||||
let (actual_steal, actual_real) = unpack(actual);
|
|
||||||
|
|
||||||
assert_ne!(actual_steal, actual_real);
|
|
||||||
|
|
||||||
prev_packed = actual;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user