-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix stop sequence for FSEvents monitor #190
Conversation
Hi @t3hk0d3, Doesn't moving |
@emcrisostomo |
I agree on that argument. I was focused on the locking stuff, to be sure I wasn't missing anything, since my memory is blurred. Ok, merged. I'll review the run/stop protocol in that monitor thoroughly because I'm actually thinking there's a race condition there: Thanks for the PR. |
@emcrisostomo You are welcome. Thanks for merging :D |
@emcrisostomo |
Hi @t3hk0d3, I'm aware of that race condition since I've written the monitor. IIRC |
If you stop monitor right after starting it in a separate thread - it might result in
segfault
and warnings like these:Code to reproduce (slightly modified
test/src/fswatch_test.c
) https://gist.github.com/t3hk0d3/a37fa9ca515ad27bbb8b756120828587Idea is to have FSEvents deinitialization logic on same thread as initialization, while
on_stop
should just interrupt (stop) runloop.It doesn't change deinitialization itself, so it should be backward-compatible.
This seems to be proper solution for me from all aspects, so you won't need to put any sleep timers before stopping monitor :)