notify on condvar before unlocking the mutex

http://www.domaigne.com/blog/computing/condvars-signal-with-mutex-locked-or-not/