Please watch the good and funny video from Pete Goodliffe about the “The Golden Rules of Audio Programming” @ ADC. Then you hopefully know why you never ever use a lock in a realtime audio thread.
Cheers, Arne