Update crossbeam

Updated crossbeam to 0.3.11 and fixed breaking changes.
This commit is contained in:
ds797
2024-05-22 17:48:43 -07:00
committed by GitHub
parent 4d7b78069f
commit 9c05cc9bd5

View File

@@ -1055,7 +1055,7 @@ To use the type, we need to add a dependency on the `crossbeam-queue` crate:
# in Cargo.toml # in Cargo.toml
[dependencies.crossbeam-queue] [dependencies.crossbeam-queue]
version = "0.2.1" version = "0.3.11"
default-features = false default-features = false
features = ["alloc"] features = ["alloc"]
``` ```
@@ -1233,8 +1233,8 @@ impl Stream for ScancodeStream {
fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<u8>> { fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<u8>> {
let queue = SCANCODE_QUEUE.try_get().expect("not initialized"); let queue = SCANCODE_QUEUE.try_get().expect("not initialized");
match queue.pop() { match queue.pop() {
Ok(scancode) => Poll::Ready(Some(scancode)), Some(scancode) => Poll::Ready(Some(scancode)),
Err(crossbeam_queue::PopError) => Poll::Pending, None => Poll::Pending,
} }
} }
} }
@@ -1284,17 +1284,17 @@ impl Stream for ScancodeStream {
.expect("scancode queue not initialized"); .expect("scancode queue not initialized");
// fast path // fast path
if let Ok(scancode) = queue.pop() { if let Some(scancode) = queue.pop() {
return Poll::Ready(Some(scancode)); return Poll::Ready(Some(scancode));
} }
WAKER.register(&cx.waker()); WAKER.register(&cx.waker());
match queue.pop() { match queue.pop() {
Ok(scancode) => { Some(scancode) => {
WAKER.take(); WAKER.take();
Poll::Ready(Some(scancode)) Poll::Ready(Some(scancode))
} }
Err(crossbeam_queue::PopError) => Poll::Pending, None => Poll::Pending,
} }
} }
} }
@@ -1546,7 +1546,7 @@ impl Executor {
waker_cache, waker_cache,
} = self; } = self;
while let Ok(task_id) = task_queue.pop() { while let Some(task_id) = task_queue.pop() {
let task = match tasks.get_mut(&task_id) { let task = match tasks.get_mut(&task_id) {
Some(task) => task, Some(task) => task,
None => continue, // task no longer exists None => continue, // task no longer exists