Reduce locking in writer_routine().