vm: close the console when exiting
This prevents an endless loop caused by the nvidia drivers on linux. See http://www.nvnews.net/vbulletin/showthread.php?t=164619db4
parent
b9a358a1df
commit
db19efe1b3
|
@ -496,6 +496,15 @@ 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.
|
||||||
|
// 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()
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&stdin_mutex);
|
||||||
|
pthread_kill(stdin_thread, SIGTERM);
|
||||||
|
}
|
||||||
|
|
||||||
void factor_vm::lock_console()
|
void factor_vm::lock_console()
|
||||||
{
|
{
|
||||||
// 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
|
||||||
|
|
|
@ -317,6 +317,10 @@ void factor_vm::unlock_console()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void factor_vm::close_console()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void factor_vm::sampler_thread_loop()
|
void factor_vm::sampler_thread_loop()
|
||||||
{
|
{
|
||||||
LARGE_INTEGER counter, new_counter, units_per_second;
|
LARGE_INTEGER counter, new_counter, units_per_second;
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace factor
|
||||||
|
|
||||||
void factor_vm::primitive_exit()
|
void factor_vm::primitive_exit()
|
||||||
{
|
{
|
||||||
|
close_console();
|
||||||
exit((int)to_fixnum(ctx->pop()));
|
exit((int)to_fixnum(ctx->pop()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -732,6 +732,7 @@ struct factor_vm
|
||||||
void start_sampling_profiler_timer();
|
void start_sampling_profiler_timer();
|
||||||
void end_sampling_profiler_timer();
|
void end_sampling_profiler_timer();
|
||||||
void open_console();
|
void open_console();
|
||||||
|
void close_console();
|
||||||
void lock_console();
|
void lock_console();
|
||||||
void unlock_console();
|
void unlock_console();
|
||||||
static void abort();
|
static void abort();
|
||||||
|
|
Loading…
Reference in New Issue