Skip to content

Commit

Permalink
vm: fashion police
Browse files Browse the repository at this point in the history
  • Loading branch information
jckarter committed Nov 13, 2011
1 parent 076d710 commit 0b45e80
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions vm/os-unix.cpp
Expand Up @@ -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)
{
Expand All @@ -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));
Expand Down Expand Up @@ -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)
Expand All @@ -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);
}
Expand Down

0 comments on commit 0b45e80

Please sign in to comment.