lock shared buffer