Solved (?) thread deadlock.

Changed direct calls to mutex (enter.exit) with  ScopedLock (RAII)