current_thread: make underlying Park instance accessible

This commit is contained in:
Stefan Bühler
2018-05-01 14:33:38 -07:00
committed by Carl Lerche
parent b36a73059d
commit 6defeeb2ba
+20
View File
@@ -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> {
Borrow {
scheduler: &mut self.scheduler,
@@ -507,6 +517,16 @@ impl<'a, P: Park> Entered<'a, P> {
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>)
-> Result<(), RunTimeoutError>
{