MCPcopy Index your code
hub / github.com/saltstack/salt / __init__

Method __init__

salt/utils/process.py:446–462  ·  view source on GitHub ↗
(self, num_threads=None, queue_size=0)

Source from the content-addressed store, hash-verified

444 """
445
446 def __init__(self, num_threads=None, queue_size=0):
447 # if no count passed, default to number of CPUs
448 if num_threads is None:
449 num_threads = multiprocessing.cpu_count()
450 self.num_threads = num_threads
451
452 # create a task queue of queue_size
453 self._job_queue = queue.Queue(queue_size)
454
455 self._workers = []
456
457 # create worker threads
458 for _ in range(num_threads):
459 thread = threading.Thread(target=self._thread_target)
460 thread.daemon = True
461 thread.start()
462 self._workers.append(thread)
463
464 # intentionally not called "apply_async" since we aren't keeping track of
465 # the return at all, if we want to make this API compatible with multiprocessing

Callers 1

__setstate__Method · 0.45

Calls 2

startMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected