Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nameexhaustion committed Apr 5, 2024
1 parent e39127e commit 2316462
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/polars-io/src/pl_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<F>(&'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))
}

Expand Down

0 comments on commit 2316462

Please sign in to comment.