Lines Matching defs:handle

26 #include "handle-inl.h"
70 int uv__read_start(uv_stream_t* handle,
76 switch (handle->type) {
78 err = uv__tcp_read_start((uv_tcp_t*)handle, alloc_cb, read_cb);
81 err = uv__pipe_read_start((uv_pipe_t*)handle, alloc_cb, read_cb);
84 err = uv__tty_read_start((uv_tty_t*) handle, alloc_cb, read_cb);
94 int uv_read_stop(uv_stream_t* handle) {
97 if (!(handle->flags & UV_HANDLE_READING))
101 if (handle->type == UV_TTY) {
102 err = uv__tty_read_stop((uv_tty_t*) handle);
103 } else if (handle->type == UV_NAMED_PIPE) {
104 uv__pipe_read_stop((uv_pipe_t*) handle);
106 handle->flags &= ~UV_HANDLE_READING;
107 DECREASE_ACTIVE_COUNT(handle->loop, handle);
115 uv_stream_t* handle,
119 uv_loop_t* loop = handle->loop;
122 if (!(handle->flags & UV_HANDLE_WRITABLE)) {
127 switch (handle->type) {
129 err = uv__tcp_write(loop, req, (uv_tcp_t*) handle, bufs, nbufs, cb);
133 loop, req, (uv_pipe_t*) handle, bufs, nbufs, NULL, cb);
136 err = uv__tty_write(loop, req, (uv_tty_t*) handle, bufs, nbufs, cb);
147 uv_stream_t* handle,
152 uv_loop_t* loop = handle->loop;
156 return uv_write(req, handle, bufs, nbufs, cb);
159 if (handle->type != UV_NAMED_PIPE || !((uv_pipe_t*) handle)->ipc) {
161 } else if (!(handle->flags & UV_HANDLE_WRITABLE)) {
166 loop, req, (uv_pipe_t*) handle, bufs, nbufs, send_handle, cb);
203 int uv_shutdown(uv_shutdown_t* req, uv_stream_t* handle, uv_shutdown_cb cb) {
204 uv_loop_t* loop = handle->loop;
206 if (!(handle->flags & UV_HANDLE_WRITABLE) ||
207 handle->flags & UV_HANDLE_SHUTTING ||
208 uv__is_closing(handle)) {
213 req->handle = handle;
216 handle->flags &= ~UV_HANDLE_WRITABLE;
217 handle->flags |= UV_HANDLE_SHUTTING;
218 handle->stream.conn.shutdown_req = req;
219 handle->reqs_pending++;
220 REGISTER_HANDLE_REQ(loop, handle, req);
222 if (handle->stream.conn.write_reqs_pending == 0) {
223 if (handle->type == UV_NAMED_PIPE)
224 uv__pipe_shutdown(loop, (uv_pipe_t*) handle, req);
233 int uv_is_readable(const uv_stream_t* handle) {
234 return !!(handle->flags & UV_HANDLE_READABLE);
238 int uv_is_writable(const uv_stream_t* handle) {
239 return !!(handle->flags & UV_HANDLE_WRITABLE);
243 int uv_stream_set_blocking(uv_stream_t* handle, int blocking) {
244 if (handle->type != UV_NAMED_PIPE)
248 handle->flags |= UV_HANDLE_BLOCKING_WRITES;
250 handle->flags &= ~UV_HANDLE_BLOCKING_WRITES;