howeyc/fsnotify — pull request #77 by cespare (2013-11-21 13:11:49+00:00)
Title: Fix deadlock on BSD

I'm using fsnotify for [a project](https://github.com/cespare/reflex) where I set up recursive watches using the usual directory walking song and dance. I noticed that on Mac OS fsnotify would quickly get into a bad state where I'd stop receiving any events.

It turned out that fsnotify was deadlocking because mutexes weren't always properly released.

The `removeWatch` routine could return without releasing the lock on `w.bufmut`. This change unlocks the mutex before checking for errors.