Lines Matching refs:s

123   uv__stream_select_t* s;  in uv__stream_osx_interrupt_select()  local
126 s = stream->select; in uv__stream_osx_interrupt_select()
127 if (s == NULL) in uv__stream_osx_interrupt_select()
135 r = write(s->fake_fd, "x", 1); in uv__stream_osx_interrupt_select()
148 uv__stream_select_t* s; in uv__stream_osx_select() local
156 s = stream->select; in uv__stream_osx_select()
157 fd = s->fd; in uv__stream_osx_select()
159 if (fd > s->int_fd) in uv__stream_osx_select()
162 max_fd = s->int_fd; in uv__stream_osx_select()
166 if (uv_sem_trywait(&s->close_sem) == 0) in uv__stream_osx_select()
170 memset(s->sread, 0, s->sread_sz); in uv__stream_osx_select()
171 memset(s->swrite, 0, s->swrite_sz); in uv__stream_osx_select()
174 FD_SET(fd, s->sread); in uv__stream_osx_select()
176 FD_SET(fd, s->swrite); in uv__stream_osx_select()
177 FD_SET(s->int_fd, s->sread); in uv__stream_osx_select()
180 r = select(max_fd + 1, s->sread, s->swrite, NULL, NULL); in uv__stream_osx_select()
194 if (FD_ISSET(s->int_fd, s->sread)) in uv__stream_osx_select()
196 r = read(s->int_fd, buf, sizeof(buf)); in uv__stream_osx_select()
215 if (FD_ISSET(fd, s->sread)) in uv__stream_osx_select()
217 if (FD_ISSET(fd, s->swrite)) in uv__stream_osx_select()
220 assert(events != 0 || FD_ISSET(s->int_fd, s->sread)); in uv__stream_osx_select()
222 ACCESS_ONCE(int, s->events) = events; in uv__stream_osx_select()
224 uv_async_send(&s->async); in uv__stream_osx_select()
225 uv_sem_wait(&s->async_sem); in uv__stream_osx_select()
228 assert((s->events == 0) || (stream->flags & UV_HANDLE_CLOSING)); in uv__stream_osx_select()
235 uv__stream_select_t* s; in uv__stream_osx_select_cb() local
239 s = container_of(handle, uv__stream_select_t, async); in uv__stream_osx_select_cb()
240 stream = s->stream; in uv__stream_osx_select_cb()
243 events = s->events; in uv__stream_osx_select_cb()
244 ACCESS_ONCE(int, s->events) = 0; in uv__stream_osx_select_cb()
262 uv_sem_post(&s->async_sem); in uv__stream_osx_select_cb()
267 uv__stream_select_t* s; in uv__stream_osx_cb_close() local
269 s = container_of(async, uv__stream_select_t, async); in uv__stream_osx_cb_close()
270 uv__free(s); in uv__stream_osx_cb_close()
283 uv__stream_select_t* s; in uv__stream_try_select() local
333 s = uv__malloc(sizeof(*s) + sread_sz + swrite_sz); in uv__stream_try_select()
334 if (s == NULL) { in uv__stream_try_select()
339 s->events = 0; in uv__stream_try_select()
340 s->fd = *fd; in uv__stream_try_select()
341 s->sread = (fd_set*) ((char*) s + sizeof(*s)); in uv__stream_try_select()
342 s->sread_sz = sread_sz; in uv__stream_try_select()
343 s->swrite = (fd_set*) ((char*) s->sread + sread_sz); in uv__stream_try_select()
344 s->swrite_sz = swrite_sz; in uv__stream_try_select()
346 err = uv_async_init(stream->loop, &s->async, uv__stream_osx_select_cb); in uv__stream_try_select()
350 s->async.flags |= UV_HANDLE_INTERNAL; in uv__stream_try_select()
351 uv__handle_unref(&s->async); in uv__stream_try_select()
353 err = uv_sem_init(&s->close_sem, 0); in uv__stream_try_select()
357 err = uv_sem_init(&s->async_sem, 0); in uv__stream_try_select()
361 s->fake_fd = fds[0]; in uv__stream_try_select()
362 s->int_fd = fds[1]; in uv__stream_try_select()
365 s->stream = stream; in uv__stream_try_select()
366 stream->select = s; in uv__stream_try_select()
367 *fd = s->fake_fd; in uv__stream_try_select()
369 err = uv_thread_create(&s->thread, uv__stream_osx_select, stream); in uv__stream_try_select()
376 s->stream = NULL; in uv__stream_try_select()
380 uv_sem_destroy(&s->async_sem); in uv__stream_try_select()
383 uv_sem_destroy(&s->close_sem); in uv__stream_try_select()
388 uv_close((uv_handle_t*) &s->async, uv__stream_osx_cb_close); in uv__stream_try_select()
392 uv__free(s); in uv__stream_try_select()
1492 const uv__stream_select_t* s; in uv___stream_fd() local
1498 s = handle->select; in uv___stream_fd()
1499 if (s != NULL) in uv___stream_fd()
1500 return s->fd; in uv___stream_fd()
1514 uv__stream_select_t* s; in uv__stream_close() local
1516 s = handle->select; in uv__stream_close()
1518 uv_sem_post(&s->close_sem); in uv__stream_close()
1519 uv_sem_post(&s->async_sem); in uv__stream_close()
1521 uv_thread_join(&s->thread); in uv__stream_close()
1522 uv_sem_destroy(&s->close_sem); in uv__stream_close()
1523 uv_sem_destroy(&s->async_sem); in uv__stream_close()
1524 uv__close(s->fake_fd); in uv__stream_close()
1525 uv__close(s->int_fd); in uv__stream_close()
1526 uv_close((uv_handle_t*) &s->async, uv__stream_osx_cb_close); in uv__stream_close()