Set the buffer after the lock is acquired.