From 2316462b348acef6519cc067fe0d3410da7a748b Mon Sep 17 00:00:00 2001 From: Simon Lin Date: Fri, 5 Apr 2024 21:20:07 +1100 Subject: [PATCH] comment --- crates/polars-io/src/pl_async.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/polars-io/src/pl_async.rs b/crates/polars-io/src/pl_async.rs index 78349b03db03..a4b656960e2b 100644 --- a/crates/polars-io/src/pl_async.rs +++ b/crates/polars-io/src/pl_async.rs @@ -231,16 +231,16 @@ impl RuntimeManager { Self { rt } } - /// Keep track of rayon threads that drive the runtime. Every thread - /// only allows a single runtime. If this thread calls block_on and this - /// rayon thread is already driving an async execution we must start a new thread - /// otherwise we panic. This can happen when we parallelize reads over 100s of files. + /// `block_on` variant that can be entered multiple times. Rayon worker threads + /// can sometimes do this due to work-stealing. + /// + /// # Safety + /// The tokio runtime flavor is multi-threaded. pub fn block_on_potential_spawn(&'static self, future: F) -> F::Output where F: Future + Send, F::Output: Send, { - // Safety: The tokio runtime flavor is multi-threaded tokio::task::block_in_place(|| self.rt.block_on(future)) }