diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2001-04-10 11:14:33 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2001-04-10 11:14:33 +0000 |
commit | 7646d818a217e7c4019bb7b6f036ae1a597941af (patch) | |
tree | 97994b0da8673e3351238498432039273cfb19a9 | |
parent | e24bac9d959eff3d55060ecdb2f7f6cf8fdf342e (diff) |
Changements cosmetiques dans le signal_thread
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3486 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | byterun/startup.c | 10 | ||||
-rw-r--r-- | byterun/win32.c | 13 |
2 files changed, 7 insertions, 16 deletions
diff --git a/byterun/startup.c b/byterun/startup.c index 1f1c17fc2..2ae98b4a9 100644 --- a/byterun/startup.c +++ b/byterun/startup.c @@ -23,7 +23,7 @@ #include <unistd.h> #endif #ifdef _WIN32 -#include <windows.h> +#include <process.h> #endif #include "alloc.h" #include "backtrace.h" @@ -302,7 +302,7 @@ static void parse_camlrunparam(void) extern void init_ieee_floats (void); #ifdef _WIN32 -extern DWORD WINAPI caml_signal_thread(LPVOID lpParam); +extern void caml_signal_thread(void * lpParam); #endif /* Main entry point when loading code from a file */ @@ -372,10 +372,8 @@ void caml_main(char **argv) sys_init(argv + pos); #ifdef _WIN32 /* Start a thread to handle signals */ - if (getenv("CAMLSIGPIPE")) { - int lpThreadId; - CreateThread(NULL, 0, caml_signal_thread, NULL, 0, &lpThreadId); - } + if (getenv("CAMLSIGPIPE")) + _beginthread(caml_signal_thread, 0, NULL); #endif /* Execute the program */ debugger(PROGRAM_START); diff --git a/byterun/win32.c b/byterun/win32.c index 20e7eab50..ed12a84a2 100644 --- a/byterun/win32.c +++ b/byterun/win32.c @@ -199,19 +199,12 @@ int win32_system(char * cmdline) /* Set up a new thread for control-C emulation */ -#define hexa_digit(ch) (ch >= 97 ? ch - 87 : \ - (ch >= 65 ? ch - 55 : \ - (ch >= 48 ? ch - 48 : 0))) - -DWORD WINAPI caml_signal_thread(LPVOID lpParam) +void caml_signal_thread(void * lpParam) { - char *data; - int i; + char *endptr; HANDLE h; /* Get an hexa-code raw handle through the environment */ - data = getenv("CAMLSIGPIPE"); - for(i = 0; i < sizeof(HANDLE); i++) - ((char*)&h)[i] = (hexa_digit(data[2*i]) << 4) + hexa_digit(data[2*i+1]); + h = (HANDLE) strtol(getenv("CAMLSIGPIPE"), &endptr, 16); while (1) { DWORD numread; BOOL ret; |