When does `increment_counter` obtain the lock, and when is it released?