vm: set stdin_loop cancellation state

Make it asynchronous so it doesn't wait till the next syscall to cancel.
db4
Joe Groff 2011-11-12 14:49:20 -08:00
parent 3fc82282f7
commit c0a44000cc
1 changed files with 5 additions and 1 deletions

View File

@ -446,6 +446,10 @@ void *stdin_loop(void *arg)
sigdelset(&mask, SIGQUIT);
pthread_sigmask(SIG_SETMASK, &mask, NULL);
int dontcare;
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &dontcare);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &dontcare);
while(loop_running)
{
if(!safe_read(control_read,buf,1))
@ -505,7 +509,7 @@ void factor_vm::open_console()
void factor_vm::close_console()
{
if (stdin_thread_initialized_p)
pthread_kill(stdin_thread, SIGTERM);
pthread_cancel(stdin_thread);
}
void factor_vm::lock_console()