def __init__(self, worker_func, task_count, worker_count=-1):
        # initialize completion task workers
        # if number of workers is not specified, set it to the number of CPUs
        if worker_count == -1:
            worker_count = 8
        self.workers = CallbackTaskWorkers(worker_func, worker_count)

        # start result manager
        if PROC_TYPE == ProcType.gipc:
            self.result_manager = gipc.start_process(target=result_manager,
                                                     args=(task_count,))
        elif PROC_TYPE == ProcType.multiprocessing:
            self.result_manager = Process(target=result_manager,
                                          args=(task_count,))
            self.result_manager.start()
        elif PROC_TYPE == ProcType.greenlet:
            self.result_manager = gevent.spawn(result_manager, task_count)

        # initialize completion task runner
        self.runner = CallbackTaskRunner()

        # wait for all workers to subscribe to control channel
        # MUST be placed above all other commands in __init__ to work
        log.debug('Waiting for %d workers to initialize...', worker_count)
        context = zmq.Context()
        syncservice = context.socket(zmq.REP)
        syncservice.bind(ZMQ_WORKER_SYNC_CH)
        subscribers = 0
        while subscribers < worker_count:
            msg = syncservice.recv()
            syncservice.send(msg) # send synchronization reply
            subscribers = subscribers + 1
        log.debug('%d workers initialized', worker_count)
dataset/ETHPy150Open kencoken/imsearch-tools/imsearchtools/process/callback_handler_zmq.py/CallbackHandler.__init__/original