Sha256: 127f3bca8fb334714131394642baa4a77ddb95b330744fe096dc13f873f9a91e

Contents?: true

Size: 1.11 KB

Versions: 22

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 = fse->events.size();
  for (idx=0; idx<cnt; idx++) {
    event = fse->events.at(idx);
    if (event == NULL) continue;
    pathptr = CFStringGetCStringPtr(event->path, kCFStringEncodingUTF8);
    if (!pathptr) CFStringGetCString(event->path, pathbuf, 1024, kCFStringEncodingUTF8);
    fse->emitEvent(pathptr ? pathptr : pathbuf, event->flags, event->id);
    delete event;
  }
  if (cnt>0) fse->events.clear();
  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

22 entries across 22 versions & 8 rubygems

Version Path
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/fsevents/src/async.cc
lux_assets-0.2.11 ./node_modules/fsevents/src/async.cc
lux_assets-0.2.9 ./node_modules/fsevents/src/async.cc
lux_assets-0.2.4 ./node_modules/fsevents/src/async.cc
lux_assets-0.2.2 ./node_modules/fsevents/src/async.cc
lux_assets-0.2.1 ./node_modules/fsevents/src/async.cc
locomotivecms-3.4.0 app/javascript/node_modules/fsevents/src/async.cc
dragonfly_puppeteer-0.1.0 node_modules/fsevents/src/async.cc
affiliator-0.2.1 node_modules/fsevents/src/async.cc
lanes-0.8.0 node_modules/fsevents/src/async.cc
brwy_rails-0.0.6 test/dummy/node_modules/fsevents/src/async.cc
brwy_rails-0.0.5 test/dummy/node_modules/fsevents/src/async.cc
brwy_rails-0.0.4 test/dummy/node_modules/fsevents/src/async.cc
brwy_rails-0.0.3 test/dummy/node_modules/fsevents/src/async.cc
brwy_rails-0.0.2 test/dummy/node_modules/fsevents/src/async.cc
brwy_rails-0.0.1 test/dummy/node_modules/fsevents/src/async.cc
es6_tilt-0.1.2 test/dummy/app/assets/javascripts/node_modules/fsevents/src/async.cc
es6_tilt-0.1.1 test/dummy/app/assets/javascripts/node_modules/fsevents/src/async.cc
es6_tilt-0.1.0 test/dummy/app/assets/javascripts/node_modules/fsevents/src/async.cc
gulp_assets-1.0.0.pre.5 template/node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/src/async.cc