Helper class to manage locks