vm: fashion police
parent
c0a44000cc
commit
c4885ac082
|
@ -446,9 +446,9 @@ 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);
|
||||
int unused;
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &unused);
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &unused);
|
||||
|
||||
while(loop_running)
|
||||
{
|
||||
|
@ -460,8 +460,8 @@ void *stdin_loop(void *arg)
|
|||
|
||||
for(;;)
|
||||
{
|
||||
// If we fep, the parent thread will grab stdin_mutex and send us
|
||||
// SIGUSR2 to interrupt the read() call.
|
||||
/* If we fep, the parent thread will grab stdin_mutex and send us
|
||||
SIGUSR2 to interrupt the read() call. */
|
||||
pthread_mutex_lock(&stdin_mutex);
|
||||
pthread_mutex_unlock(&stdin_mutex);
|
||||
ssize_t bytes = read(0,buf,sizeof(buf));
|
||||
|
@ -503,9 +503,9 @@ void factor_vm::open_console()
|
|||
pthread_mutex_init(&stdin_mutex, NULL);
|
||||
}
|
||||
|
||||
// This method is used to kill the stdin_loop before exiting from factor.
|
||||
// A Nvidia driver bug on Linux is the reason this has to be done, see:
|
||||
// http://www.nvnews.net/vbulletin/showthread.php?t=164619
|
||||
/* This method is used to kill the stdin_loop before exiting from factor.
|
||||
A Nvidia driver bug on Linux is the reason this has to be done, see:
|
||||
http://www.nvnews.net/vbulletin/showthread.php?t=164619 */
|
||||
void factor_vm::close_console()
|
||||
{
|
||||
if (stdin_thread_initialized_p)
|
||||
|
@ -515,9 +515,9 @@ void factor_vm::close_console()
|
|||
void factor_vm::lock_console()
|
||||
{
|
||||
assert(stdin_thread_initialized_p);
|
||||
// Lock the stdin_mutex and send the stdin_loop thread a signal to interrupt
|
||||
// any read() it has in progress. When the stdin loop iterates again, it will
|
||||
// try to lock the same mutex and wait until unlock_console() is called.
|
||||
/* Lock the stdin_mutex and send the stdin_loop thread a signal to interrupt
|
||||
any read() it has in progress. When the stdin loop iterates again, it will
|
||||
try to lock the same mutex and wait until unlock_console() is called. */
|
||||
pthread_mutex_lock(&stdin_mutex);
|
||||
pthread_kill(stdin_thread, SIGUSR2);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue