add code to debug deadlocks in CriticalSection