From 5c81c416312fd3cc17baea51244826647c957fd5 Mon Sep 17 00:00:00 2001 From: BoolPurist Date: Sat, 14 Sep 2024 03:41:25 +0200 Subject: [PATCH] Docs: Mentions raw OS-Thread outside an async runtime caused by EventStream This pull request is motivated by the discussion of the following [issue](https://github.com/crossterm-rs/crossterm/issues/608) --- src/event/stream.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/event/stream.rs b/src/event/stream.rs index e74dceae..686ea475 100644 --- a/src/event/stream.rs +++ b/src/event/stream.rs @@ -29,6 +29,17 @@ use crate::event::{ /// /// Check the [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples) folder to see how to use /// it (`event-stream-*`). +/// +/// ## Caveats +/// +/// On creating this future, a plain OS-thread is spawned. This thread is not scheduled +/// under the control of async runtime. This thread only shutdowns when this future is dropped ! +/// +/// This implementation will never yield an end for a stream aka a Ready(None). +/// +/// User concerned about that overhead caused by the OS thread outside an async runtime, +/// are advised to implement their own stream implementation +/// in respect to their used async runtime. #[derive(Debug)] pub struct EventStream { poll_internal_waker: Waker,