@@ -260,6 +260,13 @@ impl Handle {
260260
261261#[ cfg( feature = "simulation" ) ]
262262impl Handle {
263+ pub fn now ( & self ) -> Duration {
264+ match self {
265+ Self :: Tokio ( _) => panic ! ( "Handle::now requires a simulation runtime" ) ,
266+ Self :: Simulation ( handle) => handle. now ( ) ,
267+ }
268+ }
269+
263270 pub fn simulation ( handle : sim:: Handle ) -> Self {
264271 Self :: Simulation ( handle)
265272 }
@@ -354,14 +361,13 @@ impl Handle {
354361 }
355362 }
356363
357- pub fn now ( & self ) -> Duration {
358- match self {
359- Self :: Tokio ( _) => panic ! ( "Handle::now is only supported by the simulation runtime" ) ,
360- #[ cfg( feature = "simulation" ) ]
361- Self :: Simulation ( handle) => handle. now ( ) ,
362- }
363- }
364-
364+ /// Blocks the current thread until `future` completes.
365+ ///
366+ /// For Tokio, this uses `block_in_place` before re-entering the runtime with
367+ /// `Handle::block_on`, so it is supported from multi-thread runtime workers.
368+ /// Do not call this from a current-thread Tokio runtime; Tokio panics on
369+ /// that path. For simulation, this runs on the deterministic executor
370+ /// thread; blocking inside the future blocks simulated progress.
365371 pub fn block_on < F : Future > ( & self , future : F ) -> F :: Output {
366372 match self {
367373 Self :: Tokio ( handle) => tokio:: task:: block_in_place ( || handle. block_on ( future) ) ,
0 commit comments