Lines Matching defs:handle

432 static int uv__fs_event_rearm(uv_fs_event_t *handle) {
433 if (handle->fd == PORT_DELETED)
436 if (port_associate(handle->loop->fs_fd,
438 (uintptr_t) &handle->fo,
440 handle) == -1) {
443 handle->fd = PORT_LOADED;
452 uv_fs_event_t *handle = NULL;
481 handle = (uv_fs_event_t*) pe.portev_user;
484 if (uv__is_closing(handle)) {
485 uv__handle_stop(handle);
486 uv__make_close_pending((uv_handle_t*) handle);
496 handle->fd = PORT_FIRED;
497 handle->cb(handle, NULL, events, 0);
499 if (handle->fd != PORT_DELETED) {
500 r = uv__fs_event_rearm(handle);
502 handle->cb(handle, NULL, 0, r);
505 while (handle->fd != PORT_DELETED);
509 int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) {
510 uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_EVENT);
515 int uv_fs_event_start(uv_fs_event_t* handle,
523 if (uv__is_active(handle))
527 if (handle->loop->fs_fd == -1) {
531 handle->loop->fs_fd = portfd;
535 uv__handle_start(handle);
536 handle->path = uv__strdup(path);
537 handle->fd = PORT_UNUSED;
538 handle->cb = cb;
540 memset(&handle->fo, 0, sizeof handle->fo);
541 handle->fo.fo_name = handle->path;
542 err = uv__fs_event_rearm(handle);
544 uv_fs_event_stop(handle);
549 uv__io_init(&handle->loop->fs_event_watcher, uv__fs_event_read, portfd);
550 uv__io_start(handle->loop, &handle->loop->fs_event_watcher, POLLIN);
557 static int uv__fs_event_stop(uv_fs_event_t* handle) {
560 if (!uv__is_active(handle))
563 if (handle->fd == PORT_LOADED) {
564 ret = port_dissociate(handle->loop->fs_fd,
566 (uintptr_t) &handle->fo);
569 handle->fd = PORT_DELETED;
570 uv__free(handle->path);
571 handle->path = NULL;
572 handle->fo.fo_name = NULL;
574 uv__handle_stop(handle);
579 int uv_fs_event_stop(uv_fs_event_t* handle) {
580 (void) uv__fs_event_stop(handle);
584 void uv__fs_event_close(uv_fs_event_t* handle) {
589 * handle, causing a use-after-free problem when the event is processed.
593 if (uv__fs_event_stop(handle) == 0)
594 uv__make_close_pending((uv_handle_t*) handle);
599 int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) {
604 int uv_fs_event_start(uv_fs_event_t* handle,
612 int uv_fs_event_stop(uv_fs_event_t* handle) {
617 void uv__fs_event_close(uv_fs_event_t* handle) {