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
Is it possible to make ctrlc::platform::block_ctrl_c() public? I am currently using a Condvar to emulate the behavior of this function and being able to use it directly would greatly simplify things:
use std::sync::{Arc,Condvar,Mutex};let pair = Arc::new((Mutex::new(false),Condvar::new()));let copy = pair.clone();
ctrlc::set_handler(move || {let&(ref lock,ref cvar) = &*copy;letmut started = lock.lock().unwrap();*started = true;
cvar.notify_one();}).expect("unable to set signal handler");let&(ref lock,ref cvar) = &*pair;letmut started = lock.lock().unwrap();while !*started {
started = cvar.wait(started).unwrap();}
The text was updated successfully, but these errors were encountered:
That could be made public, but I'm just a few minor improvements away from implementing #27 and #28, which are going to make the current API obsolete. Basically the thing you're after could be implemented with Channel like I've demonstrated in the channel example in my work-in-progress branch.
Is it possible to make
ctrlc::platform::block_ctrl_c()
public? I am currently using aCondvar
to emulate the behavior of this function and being able to use it directly would greatly simplify things:The text was updated successfully, but these errors were encountered: