Skip to main content

kayrx_karx/executor/
mod.rs

1//! Dynamic task internal. Inspired by golang runtime.
2//!
3//! It is okay to do blocking inside a task, the internal will
4//! detect this, and scale the thread pool.
5//!
6//! ## Example
7//!
8//! ```rust,ignore
9//! use std::thread;
10//! use std::time::Duration;
11//!
12//! use futures_timer::Delay;
13//!
14//! fn main() {
15//!     kayrx_karx::exec(async {
16//!         for _ in 0..10 {
17//!             Delay::new(Duration::from_secs(1)).await;
18//!             println!("Non-blocking Hello World");
19//!         }
20//!     });
21//!
22//!     kayrx_karx::exec(async {
23//!         for _ in 0..10 {
24//!             thread::sleep(Duration::from_secs(1));
25//!             println!("Blocking Hello World");
26//!         }
27//!     });
28//!
29//!     thread::sleep(Duration::from_secs(11));
30//! }
31//! ```
32
33#[macro_use]
34mod utils;
35
36mod internal;
37mod thread_pool;
38
39pub use internal::spawn;