parameters: (executor_reference,
                               processes,
                               pending_work_items,
                               work_ids_queue,
                               call_queue,
                               result_queue)
docstring: Manages the communication between this process and the worker processes.
  
      This function is run in a local thread.
  
      Args:
          executor_reference: A weakref.ref to the ProcessPoolExecutor that owns
              this thread. Used to determine if the ProcessPoolExecutor has been
              garbage collected and that this function can exit.
          process: A list of the multiprocessing.Process instances used as
              workers.
          pending_work_items: A dict mapping work ids to _WorkItems e.g.
              {5: <_WorkItem...>, 6: <_WorkItem...>, ...}
          work_ids_queue: A queue.Queue of work ids e.g. Queue([5, 6, ...]).
          call_queue: A multiprocessing.Queue that will be filled with _CallItems
              derived from _WorkItems for processing by the process workers.
          result_queue: A multiprocessing.Queue of _ResultItems generated by the
              process workers.
docstring_summary: Manages the communication between this process and the worker processes.
docstring_tokens: Manages the communication between this process and the worker processes .
function: def _queue_management_worker(executor_reference,
                               processes,
                               pending_work_items,
                               work_ids_queue,
                               call_queue,
                               result_queue):
      """Manages the communication between this process and the worker processes.
  
      This function is run in a local thread.
  
      Args:
          executor_reference: A weakref.ref to the ProcessPoolExecutor that owns
              this thread. Used to determine if the ProcessPoolExecutor has been
              garbage collected and that this function can exit.
          process: A list of the multiprocessing.Process instances used as
              workers.
          pending_work_items: A dict mapping work ids to _WorkItems e.g.
              {5: <_WorkItem...>, 6: <_WorkItem...>, ...}
          work_ids_queue: A queue.Queue of work ids e.g. Queue([5, 6, ...]).
          call_queue: A multiprocessing.Queue that will be filled with _CallItems
              derived from _WorkItems for processing by the process workers.
          result_queue: A multiprocessing.Queue of _ResultItems generated by the
              process workers.
      """
      nb_shutdown_processes = [0]
      def shutdown_one_process():
          """Tell a worker to terminate, which will in turn wake us again"""
          call_queue.put(None)
          nb_shutdown_processes[0] += 1
      while True:
          _add_call_item_to_queue(pending_work_items,
                                  work_ids_queue,
                                  call_queue)
  
          result_item = result_queue.get(block=True)
          if result_item is not None:
              work_item = pending_work_items[result_item.work_id]
              del pending_work_items[result_item.work_id]
  
              if result_item.exception:
                  work_item.future.set_exception(result_item.exception)
              else:
                  work_item.future.set_result(result_item.result)
          # Check whether we should start shutting down.
          executor = executor_reference()
          # No more work items can be added if:
          #   - The interpreter is shutting down OR
          #   - The executor that owns this worker has been collected OR
          #   - The executor that owns this worker has been shutdown.
          if _shutdown or executor is None or executor._shutdown_thread:
              # Since no new work items can be added, it is safe to shutdown
              # this thread if there are no pending work items.
              if not pending_work_items:
                  while nb_shutdown_processes[0] < len(processes):
                      shutdown_one_process()
                  # If .join() is not called on the created processes then
                  # some multiprocessing.Queue methods may deadlock on Mac OS
                  # X.
                  for p in processes:
                      p.join()
                  call_queue.close()
                  return
          del executor
function_tokens: def _queue_management_worker ( executor_reference , processes , pending_work_items , work_ids_queue , call_queue , result_queue ) : nb_shutdown_processes = [ 0 ] def shutdown_one_process ( ) : """Tell a worker to terminate, which will in turn wake us again""" call_queue . put ( None ) nb_shutdown_processes [ 0 ] += 1 while True : _add_call_item_to_queue ( pending_work_items , work_ids_queue , call_queue ) result_item = result_queue . get ( block = True ) if result_item is not None : work_item = pending_work_items [ result_item . work_id ] del pending_work_items [ result_item . work_id ] if result_item . exception : work_item . future . set_exception ( result_item . exception ) else : work_item . future . set_result ( result_item . result ) # Check whether we should start shutting down. executor = executor_reference ( ) # No more work items can be added if: #   - The interpreter is shutting down OR #   - The executor that owns this worker has been collected OR #   - The executor that owns this worker has been shutdown. if _shutdown or executor is None or executor . _shutdown_thread : # Since no new work items can be added, it is safe to shutdown # this thread if there are no pending work items. if not pending_work_items : while nb_shutdown_processes [ 0 ] < len ( processes ) : shutdown_one_process ( ) # If .join() is not called on the created processes then # some multiprocessing.Queue methods may deadlock on Mac OS # X. for p in processes : p . join ( ) call_queue . close ( ) return del executor