lock mechanism implementation