def _MultiprocessCheckPaths(paths):
  """Run _CheckPath over mutltiple processes.

  Tokenization, passes, and checks are expensive operations.  Running in a
  single process, they can only run on one CPU/core.  Instead,
  shard out linting over all CPUs with multiprocessing to parallelize.

  Args:
    paths: paths to check.

  Yields:
    errorrecord.ErrorRecords for any found errors.
  """

  pool = multiprocessing.Pool()

  path_results = pool.imap(_CheckPath, paths)
  for results in path_results:
    for result in results:
      yield result

  # Force destruct before returning, as this can sometimes raise spurious
  # "interrupted system call" (EINTR), which we can ignore.
  try:
    pool.close()
    pool.join()
    del pool
  except __HOLE__ as err:
    if err.errno is not errno.EINTR:
      raise err
dataset/ETHPy150Open google/closure-linter/closure_linter/gjslint.py/_MultiprocessCheckPaths