Skip to content

Commit

Permalink
runtime comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin Ho authored and Colin Ho committed Oct 22, 2024
1 parent a5cc235 commit c0d19c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/common/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ 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
pub fn block_on<F>(&self, future: F) -> DaftResult<F::Output>
Expand All @@ -79,7 +80,8 @@ impl Runtime {
rx.recv().expect("Spawned task transmitter dropped")
}

/// Similar to block_on, but is async and can be awaited
/// Spawn a task on the runtime and await on it.
/// You should use this when you are spawning compute or IO tasks from the Executor.
pub async fn await_on<F>(&self, future: F) -> DaftResult<F::Output>
where
F: Future + Send + 'static,
Expand Down

0 comments on commit c0d19c8

Please sign in to comment.