Sha256: e78a8372be8cd2f1b97cde189563fe245df5561892772057ff84b0b13518fe02

Contents?: true

Size: 1.11 KB

Versions: 79

Compression:

Stored size: 1.11 KB

Contents

/*
** © 2014 by Philipp Dunkel <pip@pipobscure.com>
** Licensed under MIT License.
*/


void async_propagate(uv_async_t *async) {
  if (!async->data) return;
  FSEvents *fse = (FSEvents *)async->data;
  CFIndex idx, cnt;
  fse_event *event;
  char pathbuf[1024];
  const char *pathptr = NULL;
  fse->lock();
  cnt = CFArrayGetCount(fse->events);
  for (idx=0; idx<cnt; idx++) {
    event = (fse_event *)CFArrayGetValueAtIndex(fse->events, idx);
    pathptr = CFStringGetCStringPtr(event->path, kCFStringEncodingUTF8);
    if (!pathptr) CFStringGetCString(event->path, pathbuf, 1024, kCFStringEncodingUTF8);
    fse->emitEvent(pathptr ? pathptr : pathbuf, event->flags, event->id);
  }
  if (cnt>0) CFArrayRemoveAllValues(fse->events);
  fse->unlock();
}

void FSEvents::asyncStart() {
  if (async.data == this) return;
  async.data = this;
  uv_async_init(uv_default_loop(), &async, (uv_async_cb) async_propagate);
}

void FSEvents::asyncTrigger() {
  if (async.data != this) return;
  uv_async_send(&async);
}

void FSEvents::asyncStop() {
  if (async.data != this) return;
  async.data = NULL;
  uv_close((uv_handle_t *) &async, NULL);
}

Version data entries

79 entries across 79 versions & 3 rubygems

Version Path
smock-0.1.258 node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/src/async.cc
smock-0.1.256 node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/src/async.cc
smock-0.1.255 node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/src/async.cc
smock-0.1.254 node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/src/async.cc
smock-0.1.253 node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/src/async.cc
smock-0.1.252 node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/src/async.cc
smock-0.1.251 node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/src/async.cc
smock-0.1.250 node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/src/async.cc
smock-0.1.249 node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/src/async.cc
entangled-0.0.16 spec/dummy/public/node_modules/karma/node_modules/chokidar/node_modules/fsevents/src/async.cc
entangled-0.0.15 spec/dummy/public/node_modules/karma/node_modules/chokidar/node_modules/fsevents/src/async.cc
entangled-0.0.14 spec/dummy/public/node_modules/karma/node_modules/chokidar/node_modules/fsevents/src/async.cc
entangled-0.0.13 spec/dummy/public/node_modules/karma/node_modules/chokidar/node_modules/fsevents/src/async.cc
entangled-0.0.12 spec/dummy/public/node_modules/karma/node_modules/chokidar/node_modules/fsevents/src/async.cc
entangled-0.0.11 spec/dummy/public/node_modules/karma/node_modules/chokidar/node_modules/fsevents/src/async.cc
entangled-0.0.10 spec/dummy/public/node_modules/karma/node_modules/chokidar/node_modules/fsevents/src/async.cc
smock-0.1.247 node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/src/async.cc
smock-0.1.246 node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/src/async.cc
smock-0.1.245 node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/src/async.cc
smock-0.1.244 node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/src/async.cc