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