File tree 2 files changed +8
-9
lines changed
2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -295,21 +295,20 @@ impl RuntimeManager {
295
295
Self { rt }
296
296
}
297
297
298
- /// Shorthand for `tokio::task::block_in_place(|| block_on(f))`. This is a variant of `block_on`
299
- /// that is safe to call from if the current thread has already entered the async runtime, or
300
- /// is a rayon thread.
301
- ///
302
- /// # Safety
303
- /// The tokio runtime flavor is multi-threaded.
298
+ /// Forcibly blocks this thread to evaluate the given future. This can be
299
+ /// dangerous and lead to deadlocks if called re-entrantly on an async
300
+ /// worker thread as the entire thread pool can end up blocking, leading to
301
+ /// a deadlock. If you want to prevent this use block_on, which will panic
302
+ /// if called from an async thread.
304
303
pub fn block_in_place_on < F > ( & self , future : F ) -> F :: Output
305
304
where
306
305
F : Future ,
307
306
{
308
307
tokio:: task:: block_in_place ( || self . rt . block_on ( future) )
309
308
}
310
309
311
- /// Note: `block_in_place_on` should be used instead if the current thread is a rayon thread or
312
- /// has already entered the async runtime.
310
+ /// Blocks this thread to evaluate the given future. Panics if the current
311
+ /// thread is an async runtime worker thread .
313
312
pub fn block_on < F > ( & self , future : F ) -> F :: Output
314
313
where
315
314
F : Future ,
Original file line number Diff line number Diff line change @@ -233,7 +233,7 @@ fn run_subgraph(
233
233
if std:: env:: var ( "POLARS_TRACK_WAIT_STATS" ) . as_deref ( ) == Ok ( "1" ) {
234
234
async_executor:: track_task_wait_statistics ( true ) ;
235
235
}
236
- let ret = polars_io:: pl_async:: get_runtime ( ) . block_in_place_on ( async move {
236
+ let ret = polars_io:: pl_async:: get_runtime ( ) . block_on ( async move {
237
237
for handle in join_handles {
238
238
handle. await ?;
239
239
}
You can’t perform that action at this time.
0 commit comments