library for locking and waiting for conditions