diff options
author | gliderkite <gliderkite@users.noreply.github.com> | 2020-01-22 16:34:09 +0000 |
---|---|---|
committer | Lucio Franco <luciofranco14@gmail.com> | 2020-01-22 11:34:09 -0500 |
commit | 5bbf9762681ae75c6489558e15f894d0466516a3 (patch) | |
tree | 3bd4129bef5bd662547af05c132d6d6d160947eb /tokio/src/runtime | |
parent | 90969420a2ac1562e3ac523e14bae064e169bf80 (diff) |
Enhance documentation of tokio::task::block_in_place (#2155)
Diffstat (limited to 'tokio/src/runtime')
-rw-r--r-- | tokio/src/runtime/thread_pool/worker.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tokio/src/runtime/thread_pool/worker.rs b/tokio/src/runtime/thread_pool/worker.rs index 298ef06d..e8fb74d4 100644 --- a/tokio/src/runtime/thread_pool/worker.rs +++ b/tokio/src/runtime/thread_pool/worker.rs @@ -26,7 +26,9 @@ cfg_blocking! { ON_BLOCK.with(|ob| { let allow_blocking = ob .get() - .expect("can only call blocking when on Tokio runtime"); + // `block_in_place` can only be called from a spawned task when + // working with the threaded scheduler. + .expect("can call blocking only when running in a spawned task"); // This is safe, because ON_BLOCK was set from an &mut dyn FnMut in the worker that wraps // the worker's operation, and is unset just prior to when the FnMut is dropped. |