def _StopAnalysisProcesses(self, abort=False):
    logger.debug('Stopping analysis processes.')
    self._StopMonitoringProcesses()
    if abort:
      self._AbortTerminate()
    if not self._use_zeromq:
      logger.debug('Emptying queues.')
      for event_queue in self._event_queues.values():
        event_queue.Empty()
    for event_queue in self._event_queues.values():
      event_queue.PushItem(plaso_queue.QueueAbort(), block=False)
    self._AbortJoin(timeout=self._PROCESS_JOIN_TIMEOUT)
    for event_queue in self._event_queues.values():
      event_queue.Close(abort=abort)
    if abort:
      self._AbortKill()
    else:
      self._AbortTerminate()
      self._AbortJoin(timeout=self._PROCESS_JOIN_TIMEOUT)
      for event_queue in self._event_queues.values():
        event_queue.Close(abort=True)