summaryrefslogtreecommitdiffstats
path: root/third_party/rust/hyper/src/common/task.rs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/hyper/src/common/task.rs')
-rw-r--r--third_party/rust/hyper/src/common/task.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/third_party/rust/hyper/src/common/task.rs b/third_party/rust/hyper/src/common/task.rs
new file mode 100644
index 0000000000..ec70c957d6
--- /dev/null
+++ b/third_party/rust/hyper/src/common/task.rs
@@ -0,0 +1,12 @@
+#[cfg(feature = "http1")]
+use super::Never;
+pub(crate) use std::task::{Context, Poll};
+
+/// A function to help "yield" a future, such that it is re-scheduled immediately.
+///
+/// Useful for spin counts, so a future doesn't hog too much time.
+#[cfg(feature = "http1")]
+pub(crate) fn yield_now(cx: &mut Context<'_>) -> Poll<Never> {
+ cx.waker().wake_by_ref();
+ Poll::Pending
+}