0

I've create a basic version of this program https://github.com/javiergarmon/OS-X-FSEvents/blob/master/main.cpp with node-gyp, and this is the result https://github.com/javiergarmon/node-OS-X-FSEvents

The problem comes when I've try to create two listeners in the same script, because the listener is a blocking function and doesn't returns the program's control to the main thread, because the FSEventStream is blocking and the return sentence never is executed.

I don't know how to make this non-blocking exactly, when I use pthreads the program returns me segmentation fault: 11, and as this is a subset of JS, I can't use fork().

Any solution for this?

Thank's advanced!

mscdex
  • 104,356
  • 15
  • 192
  • 153
user2633604
  • 111
  • 1
  • 7
  • If you're creating a binding to FSEvents, have you already seen the [fsevents](https://github.com/pipobscure/fsevents) module (and/or [chokidar](https://github.com/paulmillr/chokidar))? – mscdex Oct 26 '14 at 21:22
  • Yes, but I wanted to do one by my own, just for learning, and the problem of non-blocking code with blocking functions is something I've not found in the internet with node-gyp. – user2633604 Oct 26 '14 at 21:26

0 Answers0