Beispiel #1
0
int uv_fs_event_stop(uv_fs_event_t* handle) {
  if (!uv__is_active(handle))
    return 0;

  uv__handle_stop(handle);

#if defined(__APPLE__)
  if (uv__fsevents_close(handle))
#endif /* defined(__APPLE__) */
  {
    uv__io_close(handle->loop, &handle->event_watcher);
  }

  uv__free(handle->path);
  handle->path = NULL;

  if (handle->event_watcher.fd != -1) {
    /* When FSEvents is used, we don't use the event_watcher's fd under certain
     * confitions. (see uv_fs_event_start) */
    uv__close(handle->event_watcher.fd);
    handle->event_watcher.fd = -1;
  }

  return 0;
}
Beispiel #2
0
void uv__fs_event_close(uv_fs_event_t* handle) {
#if defined(__APPLE__)
  if (uv__fsevents_close(handle))
    uv__fs_event_stop(handle);
#else
  uv__fs_event_stop(handle);
#endif /* defined(__APPLE__) */

  uv__handle_stop(handle);
  free(handle->filename);
  close(handle->fd);
  handle->fd = -1;
}
Beispiel #3
0
void uv__fs_event_close(uv_fs_event_t* handle) {
#if defined(__APPLE__)
  if (uv__fsevents_close(handle))
    uv__io_stop(handle->loop, &handle->event_watcher, UV__POLLIN);
#else
  uv__io_stop(handle->loop, &handle->event_watcher, UV__POLLIN);
#endif /* defined(__APPLE__) */

  uv__handle_stop(handle);

  free(handle->filename);
  handle->filename = NULL;

  close(handle->event_watcher.fd);
  handle->event_watcher.fd = -1;
}
Beispiel #4
0
int uv_fs_event_stop(uv_fs_event_t* handle) {
  if (!uv__is_active(handle))
    return -EINVAL;

  uv__handle_stop(handle);

#if defined(__APPLE__)
  if (uv__fsevents_close(handle))
#endif /* defined(__APPLE__) */
  {
    uv__io_close(handle->loop, &handle->event_watcher);
  }

  free(handle->path);
  handle->path = NULL;

  uv__close(handle->event_watcher.fd);
  handle->event_watcher.fd = -1;

  return 0;
}