Use reentrant locks