def wrapper(*args, **kwargs): future = ProcessFuture() reader, writer = Pipe(duplex=False) if get_start_method() != 'fork': target = _trampoline args = [function.__name__, function.__module__] + list(args) else: target = function worker = launch_process( _function_handler, target, args, kwargs, writer) writer.close() future.set_running_or_notify_cancel() launch_thread(_worker_handler, future, worker, reader, timeout) return future
def wrapper(*args, **kwargs): future = ProcessFuture() reader, writer = Pipe(duplex=False) if get_start_method() != 'fork': target = _trampoline args = [function.__name__, function.__module__] + list(args) else: target = function worker = launch_process(_function_handler, target, args, kwargs, writer) writer.close() future.set_running_or_notify_cancel() launch_thread(_worker_handler, future, worker, reader, timeout) return future
def wrapper(*args, **kwargs): future = ProcessFuture() reader, writer = mp_context.Pipe(duplex=False) if start_method != 'fork': target = _trampoline args = [_qualname(function), function.__module__] + list(args) else: target = function worker = launch_process(name, _function_handler, daemon, mp_context, target, args, kwargs, (reader, writer)) writer.close() future.set_running_or_notify_cancel() launch_thread(name, _worker_handler, True, future, worker, reader, timeout) return future