vm: clean up windows ctrl-handler
parent
c70a1004f8
commit
8e66c7abee
|
@ -23,10 +23,8 @@ void factor_vm::init_c_io()
|
|||
|
||||
void factor_vm::io_error()
|
||||
{
|
||||
#ifndef WINCE
|
||||
if(errno == EINTR)
|
||||
return;
|
||||
#endif
|
||||
|
||||
general_error(ERROR_IO,tag_fixnum(errno),false_object);
|
||||
}
|
||||
|
@ -50,7 +48,7 @@ int factor_vm::safe_fgetc(FILE *stream)
|
|||
int c;
|
||||
for(;;)
|
||||
{
|
||||
c = fgetc(stream);
|
||||
c = getc(stream);
|
||||
if(c == EOF)
|
||||
{
|
||||
if(feof(stream))
|
||||
|
@ -89,7 +87,7 @@ void factor_vm::safe_fputc(int c, FILE *stream)
|
|||
{
|
||||
for(;;)
|
||||
{
|
||||
if(fputc(c,stream) == EOF)
|
||||
if(putc(c,stream) == EOF)
|
||||
io_error();
|
||||
else
|
||||
break;
|
||||
|
|
|
@ -287,15 +287,8 @@ static BOOL WINAPI ctrl_handler(DWORD dwCtrlType)
|
|||
VM we can get. This will not be a good idea when we actually support native
|
||||
threads. */
|
||||
assert(thread_vms.size() == 1);
|
||||
THREADHANDLE vm_thread = thread_vms.begin()->first;
|
||||
factor_vm *vm = thread_vms.begin()->second;
|
||||
|
||||
assert(SuspendThread(vm_thread) == 0);
|
||||
std::cout << "handling ctrl-c" << std::endl;
|
||||
|
||||
vm->enqueue_safepoint_fep();
|
||||
MemoryBarrier();
|
||||
assert(ResumeThread(vm_thread) == 1);
|
||||
return TRUE;
|
||||
}
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue