thread-waker 1.2.0

Waker implementation using current thread token
Documentation
  • Coverage
  • 100%
    3 out of 3 items documented1 out of 3 items with examples
  • Size
  • Source code size: 6.19 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.06 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • DoumanAsh/thread-waker
    1 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • DoumanAsh

thread-waker

Rust Crates.io Documentation

Waker implementation using current thread token.

This is useful to work with futures without actually employing runtime

Usage

use core::{time, task};
use std::thread;

use thread_waker::waker;

fn my_future(waker: task::Waker) {
    thread::sleep(time::Duration::from_millis(250));
    waker.wake();
}

let waker = waker(thread::current());

for _ in 0..4 {
    let waker = waker.clone();
    thread::spawn(move || my_future(waker));
    thread::park();
}

println!("I'm done!");