Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ManualResetEvent to use PinList #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ name = "futures_intrusive"

[features]
alloc = ["futures-core/alloc"]
std = ["alloc", "parking_lot"]
std = ["alloc", "parking_lot", "pin-list/std"]
default = ["std"]

[dependencies]
futures-core = { version = "^0.3", default-features = false }
lock_api = "0.4.1"
parking_lot = { version = "0.12.0", optional = true }
pin-list = "0.1.0"
pin-project-lite = "0.2.9"

[dev-dependencies]
futures = { version = "0.3.0", default-features = true, features=["async-await"] }
Expand Down
6 changes: 3 additions & 3 deletions src/channel/mpmc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::intrusive_double_linked_list::{LinkedList, ListNode};
use crate::{
buffer::{ArrayBuf, RingBuf},
utils::update_waker_ref,
utils::update_option_waker_ref,
NoopLock,
};
use core::{marker::PhantomData, pin::Pin};
Expand Down Expand Up @@ -182,7 +182,7 @@ where
// to unregistered there can't be space available in the channel.
// However the caller might have passed a different `Waker`.
// In this case we need to update it.
update_waker_ref(&mut wait_node.task, cx);
update_option_waker_ref(&mut wait_node.task, cx);
(Poll::Pending, None, None)
}
SendPollState::SendComplete => {
Expand Down Expand Up @@ -289,7 +289,7 @@ where
// to unregistered there can't be any value in the channel in
// this state. However the caller might have passed a different `Waker`.
// In this case we need to update it.
update_waker_ref(&mut wait_node.task, cx);
update_option_waker_ref(&mut wait_node.task, cx);
Poll::Pending
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/channel/oneshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use super::{
};
use crate::{
intrusive_double_linked_list::{LinkedList, ListNode},
utils::update_waker_ref,
utils::update_option_waker_ref,
NoopLock,
};
use core::marker::PhantomData;
Expand Down Expand Up @@ -111,7 +111,7 @@ impl<T> ChannelState<T> {
// to unregistered there can't be any value in the channel in this state.
// However the caller might have passed a different `Waker`.
// In this case we need to update it.
update_waker_ref(&mut wait_node.task, cx);
update_option_waker_ref(&mut wait_node.task, cx);
Poll::Pending
}
RecvPollState::Notified => {
Expand Down
4 changes: 2 additions & 2 deletions src/channel/oneshot_broadcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use super::{
};
use crate::{
intrusive_double_linked_list::{LinkedList, ListNode},
utils::update_waker_ref,
utils::update_option_waker_ref,
NoopLock,
};
use core::marker::PhantomData;
Expand Down Expand Up @@ -116,7 +116,7 @@ where
// to unregistered there can't be any value in the channel in this state.
// However the caller might have passed a different `Waker`.
// In this case we need to update it.
update_waker_ref(&mut wait_node.task, cx);
update_option_waker_ref(&mut wait_node.task, cx);
Poll::Pending
}
RecvPollState::Notified => {
Expand Down
4 changes: 2 additions & 2 deletions src/channel/state_broadcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use super::{ChannelSendError, CloseStatus};
use crate::{
intrusive_double_linked_list::{LinkedList, ListNode},
utils::update_waker_ref,
utils::update_option_waker_ref,
NoopLock,
};
use core::marker::PhantomData;
Expand Down Expand Up @@ -288,7 +288,7 @@ where
// to unregistered there can't be any value in the channel in this state.
// However the caller might have passed a different `Waker`.
// In this case we need to update it.
update_waker_ref(&mut wait_node.task, cx);
update_option_waker_ref(&mut wait_node.task, cx);
Poll::Pending
}
}
Expand Down
Loading