Global lock implementation