From 734b8051613d689f7f45962c78f7681ada21d320 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 25 May 2010 13:01:06 +0000 Subject: Patch provided by Sylvain Le Gall: - Fix #4894: Windows (mingw): Unix.select and non-blocking sockets, add a filedescr.flags_fd in win32unix/unixsupport.h. It contains the non-blocking status of the associated filedescr and helps to restore this status after a select. - Fix #4789: Windows: Unix.select failing with EPIPE error, Apply patch provided by J. Vouillon - Fix #4973: Failure "Unknown handle", Be consistent between Windows and Linux, raise an EBADF Unix_error for a closed pipe handle. - Fix #4844: Unix.select bug (triggered if linked against threads), Apply patch by C. Bauer, replace lpOrig by lpOrigIdx which can survive a GC collection For otherlibs/win32unix/{select|windbug}.c: - Remove Heap* fucntions to allocate/free memory and replace it by caml_stat_* function, which are more OCaml compliant - Rework DBUG message, use DEBUG_PRINT rather than #ifdef DBUG... #endif and use DEBUG variable (more OCaml compliant), also remove dbug_init functions and use a static variable to replace it (subject to race condition but this not really important, because every path lead to same initialization) - Use a fast start scheme for pipe polling, rather than always waiting 10ms, start by 1, 2, 4, 8 and then 10ms. The 4 first times give select a chance to a fast answer. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10467 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- otherlibs/win32unix/unixsupport.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'otherlibs/win32unix/unixsupport.c') diff --git a/otherlibs/win32unix/unixsupport.c b/otherlibs/win32unix/unixsupport.c index 6e32a39e7..2f545c19f 100644 --- a/otherlibs/win32unix/unixsupport.c +++ b/otherlibs/win32unix/unixsupport.c @@ -53,6 +53,7 @@ value win_alloc_handle(HANDLE h) Handle_val(res) = h; Descr_kind_val(res) = KIND_HANDLE; CRT_fd_val(res) = NO_CRT_FD; + Flags_fd_val(res) = 0; return res; } @@ -62,6 +63,7 @@ value win_alloc_socket(SOCKET s) Socket_val(res) = s; Descr_kind_val(res) = KIND_SOCKET; CRT_fd_val(res) = NO_CRT_FD; + Flags_fd_val(res) = 0; return res; } -- cgit v1.2.3-70-g09d2