示例#1
0
文件: inotify.c 项目: Math-/node
void uv__fs_event_close(uv_fs_event_t* handle) {
  uv__inotify_rm_watch(handle->loop->inotify_fd, handle->fd);
  remove_watcher(handle);
  handle->fd = -1;

  free(handle->filename);
  handle->filename = NULL;
}
示例#2
0
static void maybe_free_watcher_list(struct watcher_list* w, uv_loop_t* loop) {
  /* if the watcher_list->watchers is being iterated over, we can't free it. */
  if ((!w->iterating) && QUEUE_EMPTY(&w->watchers)) {
    /* No watchers left for this path. Clean up. */
    RB_REMOVE(watcher_root, CAST(&loop->inotify_watchers), w);
    uv__inotify_rm_watch(loop->inotify_fd, w->wd);
    uv__free(w);
  }
}
示例#3
0
int uv_fs_event_stop(uv_fs_event_t* handle) {
  struct watcher_list* w;

  if (!uv__is_active(handle))
    return 0;

  w = find_watcher(handle->loop, handle->wd);
  assert(w != NULL);

  handle->wd = -1;
  handle->path = NULL;
  uv__handle_stop(handle);
  QUEUE_REMOVE(&handle->watchers);

  if (QUEUE_EMPTY(&w->watchers)) {
    /* No watchers left for this path. Clean up. */
    RB_REMOVE(watcher_root, CAST(&handle->loop->inotify_watchers), w);
    uv__inotify_rm_watch(handle->loop->inotify_fd, w->wd);
    uv__free(w);
  }

  return 0;
}