From 8c4b6ebb338c8a61c607782908254aadead0c3cd Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Wed, 29 Jan 2014 23:08:45 +0100 Subject: Work around for bug in threads + blocking io streamlined --- lib/spawned.ml | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'lib/spawned.ml') diff --git a/lib/spawned.ml b/lib/spawned.ml index 29cf517690..9c304435b5 100644 --- a/lib/spawned.ml +++ b/lib/spawned.ml @@ -83,25 +83,3 @@ let get_channels () = | None -> Errors.anomaly(Pp.str "init_channels not called") | Some(ic, oc) -> ic, oc -let prepare_in_channel_for_thread_friendly_blocking_input ic = - if Sys.os_type = "Win32" then Unix.set_nonblock (Unix.descr_of_in_channel ic) - else () - -let thread_friendly_blocking_input ic = - if Sys.os_type = "Win32" then - let open Unix in - let open Thread in - let fd = descr_of_in_channel ic in - let rec loop buf n = - try read fd buf 0 n - with - | Unix.Unix_error((Unix.EWOULDBLOCK|Unix.EAGAIN),_,_) -> - (* We wait for some data explicitly yielding each second *) - while not (wait_timed_read fd 1.0) do yield () done; - loop buf n - | Unix.Unix_error _ -> 0 - in - loop - else - (fun buf n -> Pervasives.input ic buf 0 n) - -- cgit v1.2.3