aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEnrico Tassi2014-12-11 14:27:46 +0100
committerEnrico Tassi2014-12-17 15:05:04 +0100
commit2d66c7d508f6bd198969012241082e34a5b6047c (patch)
tree33b632f3118c8166a05211aa5a05375268fb78a3 /lib
parent433f0bc4e5110db09c770022b277c419f8b35f64 (diff)
CThread: use a different type for thread friendly in_channels
Diffstat (limited to 'lib')
-rw-r--r--lib/cThread.ml4
-rw-r--r--lib/cThread.mli12
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/cThread.ml b/lib/cThread.ml
index 19f14637de..7a3f152003 100644
--- a/lib/cThread.ml
+++ b/lib/cThread.ml
@@ -6,8 +6,10 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
+type thread_ic = in_channel
+
let prepare_in_channel_for_thread_friendly_io ic =
- Unix.set_nonblock (Unix.descr_of_in_channel ic)
+ Unix.set_nonblock (Unix.descr_of_in_channel ic); ic
let safe_wait_timed_read fd time =
try Thread.wait_timed_read fd time
diff --git a/lib/cThread.mli b/lib/cThread.mli
index ada492dd40..d68a392d1e 100644
--- a/lib/cThread.mli
+++ b/lib/cThread.mli
@@ -14,11 +14,13 @@
* an unbounded wait has the same problem. *)
(* Use only the following functions on the channel *)
-val prepare_in_channel_for_thread_friendly_io : in_channel -> unit
-val thread_friendly_input_value : in_channel -> 'a
+type thread_ic
+val prepare_in_channel_for_thread_friendly_io : in_channel -> thread_ic
+
+val thread_friendly_input_value : thread_ic -> 'a
val thread_friendly_read :
- in_channel -> string -> off:int -> len:int -> int
+ thread_ic -> string -> off:int -> len:int -> int
val thread_friendly_really_read :
- in_channel -> string -> off:int -> len:int -> unit
-val thread_friendly_really_read_line : in_channel -> string
+ thread_ic -> string -> off:int -> len:int -> unit
+val thread_friendly_really_read_line : thread_ic -> string