unix, windows: clarify what uv_stream_set_blocking does
Also replace the assert with an error on unix.
This commit is contained in:
parent
7ad8f74302
commit
b055538d09
@ -749,11 +749,7 @@ UV_EXTERN int uv_is_writable(const uv_stream_t* handle);
|
|||||||
* Relying too much on this API is not recommended. It is likely to change
|
* Relying too much on this API is not recommended. It is likely to change
|
||||||
* significantly in the future.
|
* significantly in the future.
|
||||||
*
|
*
|
||||||
* On windows this currently works only for uv_pipe_t instances. On unix it
|
* Currently this only works on Windows and only for uv_pipe_t handles.
|
||||||
* 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
|
* Also libuv currently makes no ordering guarantee when the blocking mode
|
||||||
* is changed after write requests have already been submitted. Therefore it is
|
* is changed after write requests have already been submitted. Therefore it is
|
||||||
|
|||||||
@ -1511,7 +1511,5 @@ void uv__stream_close(uv_stream_t* handle) {
|
|||||||
|
|
||||||
|
|
||||||
int uv_stream_set_blocking(uv_stream_t* handle, int blocking) {
|
int uv_stream_set_blocking(uv_stream_t* handle, int blocking) {
|
||||||
assert(0 && "implement me");
|
return UV_ENOSYS;
|
||||||
abort();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -244,6 +244,9 @@ int uv_is_writable(const uv_stream_t* handle) {
|
|||||||
|
|
||||||
|
|
||||||
int uv_stream_set_blocking(uv_stream_t* handle, int blocking) {
|
int uv_stream_set_blocking(uv_stream_t* handle, int blocking) {
|
||||||
|
if (stream->type != UV_NAMED_PIPE)
|
||||||
|
return UV_EINVAL;
|
||||||
|
|
||||||
if (blocking != 0)
|
if (blocking != 0)
|
||||||
handle->flags |= UV_HANDLE_BLOCKING_WRITES;
|
handle->flags |= UV_HANDLE_BLOCKING_WRITES;
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user