class_docstr: Dataset iterator that loads examples in parallel.
  
  This is an implementation of :class:`~chainer.dataset.Iterator` that loads
  examples with worker threads. It uses the standard :mod:`threading`
  module to parallelize the loading.
  
  Note that this iterator effectively prefetches the examples for the next
  batch asynchronously after the current batch is returned.
  
  This iterator saves ``-1`` instead of ``None`` in snapshots since some
  serializers do not support ``None``.
  
  Args:
      dataset (~chainer.dataset.Dataset): Dataset to iterate.
      batch_size (int): Number of examples within each batch.
      repeat (bool): If ``True``, it infinitely loops over the dataset.
          Otherwise, it stops iteration at the end of the first epoch.
      shuffle (bool): If ``True``, the order of examples is shuffled at the
          beginning of each epoch. Otherwise, examples are extracted in the
          order of indexes. If ``None`` and no ``order_sampler`` is given,
          the behavior is the same as the case with ``shuffle=True``.
      n_threads (int): Number of worker threads.
      order_sampler (callable): A callable that generates the order
          of the indices to sample in the next epoch when a epoch finishes.
          This function should take two arguments: the current order
          and the current position of the iterator.
          This should return the next order. The size of the order
          should remain constant.
          This option cannot be used when ``shuffle`` is not ``None``.
code: def finalize(self):
      pool = self._pool
  
      self._next = None
      self._pool = None
      if pool is not None:
          pool.terminate()
  
imports: from __future__ import division
  from multiprocessing import pool
  import numpy
  from chainer.dataset import iterator
  from chainer.iterators import _statemachine
  from chainer.iterators.order_samplers import ShuffleOrderSampler
label_desc: Use image node_id 3 for calling the MultithreadIterator obj's underlying member method code with example usage: obj.finalize() without return types