lockvar/unlockvar depth should be NIL if no one specified