Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
Created June 7, 2013 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piscisaureus/5731532 to your computer and use it in GitHub Desktop.
Save piscisaureus/5731532 to your computer and use it in GitHub Desktop.
/*
* Enable or disable blocking mode for a stream.
*
* When blocking mode is enables all writes complete synchronously. The
* interface remains unchanged otherwise, e.g. completion or failure of the
* operation will still be reported through a callback which is made
* asychronously.
*
* Relying too much on this API is not recommended. It is likely to change
* significantly in the future.
*
* On windows this currently works only for uv_pipe_t instances. On unix it
* works for tcp, pipe and tty instances. Be aware that changing the blocking
* mode on unix sets or clears the O_NONBLOCK bit. If you are sharing a handle
* with another process, the other process is affected by the change too,
* which can lead to unexpected results.
*
* Also libuv currently makes no ordering guarantee when the blocking mode
* is changed after write requests have already been submitted. Therefore it is
* recommended to set the blocking mode immediately after opening or creating
* the stream.
*/
UV_EXTERN void uv_stream_set_blocking(uv_stream_t* handle, int blocking);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment