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!