Fixed deadlock in callback.cpp

boost::condition_variable::notify* functions should be called when mutex
assotiated with conditiona variable is locked. In other case there is a
possibility of deadlock in pthread internals. In boost 1.47 problem was
solved by adding internal mutex, but there is no fixes in 1.40.

So, to solve deadlocks mutex lock is moved upper and now it's holded
during whoole callback::handler() body.