class_docstr: Executes *nproc* tasks in parallel after forking.
class_docstr_tok: ["Executes","*","nproc","*","tasks","in","parallel","after","forking","."]
code: def __init__(self, nproc: int) -> None:
      self.nproc = nproc
      # (optional) function performed by each task on the result of main task
      self._result_funcs: dict[int, Callable] = {}
      # task arguments
      self._args: dict[int, list[Any] | None] = {}
      # list of subprocesses (both started and waiting)
      self._procs: dict[int, Any] = {}
      # list of receiving pipe connections of running subprocesses
      self._precvs: dict[int, Any] = {}
      # list of receiving pipe connections of waiting subprocesses
      self._precvsWaiting: dict[int, Any] = {}
      # number of working subprocesses
      self._pworking = 0
      # task number of each subprocess
      self._taskid = 0
  
file_path: sphinx/sphinx/util/parallel.py
imports: from __future__ import annotations
  import os
  import time
  import traceback
  from math import sqrt
  from typing import TYPE_CHECKING, Any, Callable
  from sphinx.errors import SphinxParallelError
  from sphinx.util import logging
label_desc: Use image node_id 1 to create a new ParallelTasks object  with example: obj = ParallelTasks(nproc)