emcrisostomo / fswatch

A cross-platform file change monitor with multiple backends: Apple OS X File System Events, *BSD kqueue, Solaris/Illumos File Events Notification, Linux inotify, Microsoft Windows and a stat()-based backend.
https://emcrisostomo.github.io/fswatch/
GNU General Public License v3.0
5.06k stars 330 forks source link

fsw_start_monitor never return while calling from CFFI #126

Closed muyinliu closed 8 years ago

muyinliu commented 8 years ago

I use CFFI(Common Lisp) to wrap libfswatch, foreign function fsw_start_monitor never return, is it fsw_start_monitor a blocked function? Should I wrap fsw_start_monitor calls in a thread?

emcrisostomo commented 8 years ago

Hi @muyinliu,

Yes, monitor::start() and its C wrapper fsw_start_monitor are blocking function calls. You should definitely manage threading yourself if you wanted to invoke them. It could be as easy as firing the monitor in a separate thread and just rely on the callback to receive change events.