wtx 0.44.3

A collection of different transport implementations and related tools focused primarily on web technologies.
Documentation
use alloc::{sync::Arc, task::Wake};
use core::task::Waker;
use std::thread;

pub(crate) struct CurrThreadWaker {
  pub(crate) thread: thread::Thread,
}

impl CurrThreadWaker {
  pub(crate) fn waker() -> Waker {
    Waker::from(Arc::new(CurrThreadWaker { thread: thread::current() }))
  }
}

impl Wake for CurrThreadWaker {
  #[inline]
  fn wake(self: Arc<Self>) {
    self.thread.unpark();
  }

  #[inline]
  fn wake_by_ref(self: &Arc<Self>) {
    self.thread.unpark();
  }
}