package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.gio/Ocgtk_gio/Gio/Wrappers/Pollable_output_stream/index.html

Module Wrappers.Pollable_output_stream

type t = [ `pollable_output_stream ] Gobject.obj
val from_gobject : 'a Gobject.obj -> t
val writev_nonblocking : t -> [ `output_vector ] Gobject.obj array -> Gsize.t -> [ `cancellable | `object_ ] Gobject.obj option -> (Gio_enums.pollablereturn * Gsize.t, GError.t) result

Attempts to write the bytes contained in the @n_vectors @vectors to @stream, as with g_output_stream_writev(). If @stream is not currently writable, this will immediately return %@G_POLLABLE_RETURN_WOULD_BLOCK, and you can use g_pollable_output_stream_create_source() to create a #GSource that will be triggered when @stream is writable. @error will *not* be set in that case.

Note that since this method never blocks, you cannot actually use @cancellable to cancel it. However, it will return an error if @cancellable has already been cancelled when you call, which may happen if you call this method after a source triggers due to having been cancelled.

Also note that if %G_POLLABLE_RETURN_WOULD_BLOCK is returned some underlying transports like D/TLS require that you re-send the same @vectors and @n_vectors in the next write call.

The behaviour of this method is undefined if g_pollable_output_stream_can_poll() returns %FALSE for @stream.

val is_writable : t -> bool

Checks if @stream can be written.

Note that some stream types may not be able to implement this 100% reliably, and it is possible that a call to g_output_stream_write() after this returns %TRUE would still block. To guarantee non-blocking behavior, you should always use g_pollable_output_stream_write_nonblocking(), which will return a %G_IO_ERROR_WOULD_BLOCK error rather than blocking.

The behaviour of this method is undefined if g_pollable_output_stream_can_poll() returns %FALSE for @stream.

val can_poll : t -> bool

Checks if @stream is actually pollable. Some classes may implement #GPollableOutputStream but have only certain instances of that class be pollable. If this method returns %FALSE, then the behavior of other #GPollableOutputStream methods is undefined.

For any given stream, the value returned by this method is constant; a stream cannot switch from pollable to non-pollable or vice versa.