Debugged locks and barriers