Use queue for acquiring locks