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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 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()
 | 
			
		||||
{
 | 
			
		||||
	// 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()
 | 
			
		||||
{
 | 
			
		||||
	LARGE_INTEGER counter, new_counter, units_per_second;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,6 +5,7 @@ namespace factor
 | 
			
		|||
 | 
			
		||||
void factor_vm::primitive_exit()
 | 
			
		||||
{
 | 
			
		||||
	close_console();
 | 
			
		||||
	exit((int)to_fixnum(ctx->pop()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue