summaryrefslogtreecommitdiff
path: root/stdlib/out_channel.mli
diff options
context:
space:
mode:
authorNicolás Ojeda Bär <n.oje.bar@gmail.com>2021-09-15 17:07:39 +0200
committerGitHub <noreply@github.com>2021-09-15 17:07:39 +0200
commit359f46f2241fe828ad7eb6252cc8fd68ce92731d (patch)
treef0d47dca64d17b03c0d0074ab21ed0679c86fce1 /stdlib/out_channel.mli
parent8a3347438b904d6970bd6799963812609da2cbac (diff)
downloadocaml-359f46f2241fe828ad7eb6252cc8fd68ce92731d.tar.gz
Add `Out_channel.{is,set}_buffered` to control buffering of output channels (#10538)
Diffstat (limited to 'stdlib/out_channel.mli')
-rw-r--r--stdlib/out_channel.mli16
1 files changed, 16 insertions, 0 deletions
diff --git a/stdlib/out_channel.mli b/stdlib/out_channel.mli
index 9b94eaaaba..8a70b50cda 100644
--- a/stdlib/out_channel.mli
+++ b/stdlib/out_channel.mli
@@ -129,3 +129,19 @@ val set_binary_mode : t -> bool -> unit
This function has no effect under operating systems that do not distinguish
between text mode and binary mode. *)
+
+val set_buffered : t -> bool -> unit
+(** [set_buffered oc true] sets the channel [oc] to {e buffered} mode. In this
+ mode, data output on [oc] will be buffered until either the internal buffer
+ is full or the function {!flush} or {!flush_all} is called, at which point
+ it will be sent to the output device.
+
+ [set_buffered oc false] sets the channel [oc] to {e unbuffered} mode. In
+ this mode, data output on [oc] will be sent to the output device
+ immediately.
+
+ All channels are open in {e buffered} mode by default. *)
+
+val is_buffered : t -> bool
+(** [is_buffered oc] returns whether the channel [oc] is buffered (see
+ {!set_buffered}). *)