You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I realize it is a hack but this works great for me. My threads can use normal await without consuming any resources as they "sleep". Once this driver is running in the background everything seems to work well. I also use interrupt that is a key part to make it work.
struct InfiniteSleep;
impl Future for InfiniteSleep {
type Output = ();
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> PollSelf::Output {
cx.waker().wake_by_ref(); //not strictly needed, defencive
trace!("InfiniteSleep Started");
thread::park();
Poll::Pending
}
}
//call this on startup: nuclei::spawn_blocking(|| { nuclei::drive(InfiniteSleep); }).detach();
Is there a way to opt out of the multi-threaded runtime and ensure everything runs on a single thread?
Also, is there a way to sleep?
The text was updated successfully, but these errors were encountered: