From 6defeeb2bacf26201da94dc938ed167f3dcdbf80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Sun, 15 Apr 2018 15:55:30 +0200 Subject: [PATCH] current_thread: make underlying `Park` instance accessible --- src/executor/current_thread/mod.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/executor/current_thread/mod.rs b/src/executor/current_thread/mod.rs index 3681e9969..70eb8e515 100644 --- a/src/executor/current_thread/mod.rs +++ b/src/executor/current_thread/mod.rs @@ -383,6 +383,16 @@ impl CurrentThread

{ } } + /// 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 { 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) -> Result<(), RunTimeoutError> {