diff options
Diffstat (limited to 'otherlibs/win32unix')
-rw-r--r-- | otherlibs/win32unix/winwait.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/otherlibs/win32unix/winwait.c b/otherlibs/win32unix/winwait.c index 0a68076b4..bac345b40 100644 --- a/otherlibs/win32unix/winwait.c +++ b/otherlibs/win32unix/winwait.c @@ -41,12 +41,15 @@ static int wait_flag_table[] = { CAML_WNOHANG, CAML_WUNTRACED }; CAMLprim value win_waitpid(value vflags, value vpid_req) { int flags; - DWORD status; + DWORD status, retcode; HANDLE pid_req = (HANDLE) Long_val(vpid_req); flags = convert_flag_list(vflags, wait_flag_table); if ((flags & CAML_WNOHANG) == 0) { - if (WaitForSingleObject(pid_req, INFINITE) == WAIT_FAILED) { + enter_blocking_section(); + retcode = WaitForSingleObject(pid_req, INFINITE); + leave_blocking_section(); + if (retcode == WAIT_FAILED) { win32_maperr(GetLastError()); uerror("waitpid", Nothing); } |