Named reentrant locks with deadlock detection