Skip to content

Commit

Permalink
[CHORE] Explain block_on function in common-runtime (#3442)
Browse files Browse the repository at this point in the history
Addresses: #3435

---------

Co-authored-by: Colin Ho <colinho@Colins-MacBook-Pro.local>
  • Loading branch information
colin-ho and Colin Ho authored Nov 27, 2024
1 parent 2db1233 commit e89c9f5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/common/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ impl Runtime {

/// Spawns a task on the runtime and blocks the current thread until the task is completed.
/// Similar to tokio's Runtime::block_on but requires static lifetime + Send
/// You should use this when you are spawning IO tasks from an Expression Evaluator or in the Executor
/// You should use this when you need to run an async task in a synchronous function, but you are already in a tokio runtime.
///
/// For example, URL download is an async function, but it is called from a synchronous function in a tokio runtime,
/// i.e. calling the Expression Evaluator from the Native Executor.
///
/// In the future, we should refactor the code to be fully async, but for now, this is a workaround.
pub fn block_on<F>(&self, future: F) -> DaftResult<F::Output>
where
F: Future + Send + 'static,
Expand Down

0 comments on commit e89c9f5

Please sign in to comment.