nuclei
nuclei copied to clipboard
Single threaded runtime?
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?
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();
@kmf-lab That is a really neat workaround, thanks for sharing