mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-27 00:00:12 +02:00
current_thread: make underlying Park instance accessible
This commit is contained in:
committed by
Carl Lerche
parent
b36a73059d
commit
6defeeb2ba
@@ -383,6 +383,16 @@ impl<P: Park> CurrentThread<P> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a reference to the underlying `Park` instance.
|
||||||
|
pub fn get_park(&self) -> &P {
|
||||||
|
&self.park
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a mutable reference to the underlying `Park` instance.
|
||||||
|
pub fn get_park_mut(&mut self) -> &mut P {
|
||||||
|
&mut self.park
|
||||||
|
}
|
||||||
|
|
||||||
fn borrow(&mut self) -> Borrow<P::Unpark> {
|
fn borrow(&mut self) -> Borrow<P::Unpark> {
|
||||||
Borrow {
|
Borrow {
|
||||||
scheduler: &mut self.scheduler,
|
scheduler: &mut self.scheduler,
|
||||||
@@ -507,6 +517,16 @@ impl<'a, P: Park> Entered<'a, P> {
|
|||||||
Ok(Turn { polled })
|
Ok(Turn { polled })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a reference to the underlying `Park` instance.
|
||||||
|
pub fn get_park(&self) -> &P {
|
||||||
|
&self.executor.park
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a mutable reference to the underlying `Park` instance.
|
||||||
|
pub fn get_park_mut(&mut self) -> &mut P {
|
||||||
|
&mut self.executor.park
|
||||||
|
}
|
||||||
|
|
||||||
fn run_timeout2(&mut self, dur: Option<Duration>)
|
fn run_timeout2(&mut self, dur: Option<Duration>)
|
||||||
-> Result<(), RunTimeoutError>
|
-> Result<(), RunTimeoutError>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user