MCPcopy Index your code
hub / github.com/RustPython/RustPython / submit

Method submit

Lib/concurrent/futures/process.py:788–810  ·  view source on GitHub ↗
(self, fn, /, *args, **kwargs)

Source from the content-addressed store, hash-verified

786 self._processes[p.pid] = p
787
788 def submit(self, fn, /, *args, **kwargs):
789 with self._shutdown_lock:
790 if self._broken:
791 raise BrokenProcessPool(self._broken)
792 if self._shutdown_thread:
793 raise RuntimeError('cannot schedule new futures after shutdown')
794 if _global_shutdown:
795 raise RuntimeError('cannot schedule new futures after '
796 'interpreter shutdown')
797
798 f = _base.Future()
799 w = _WorkItem(f, fn, args, kwargs)
800
801 self._pending_work_items[self._queue_count] = w
802 self._work_ids.put(self._queue_count)
803 self._queue_count += 1
804 # Wake up queue management thread
805 self._executor_manager_thread_wakeup.wakeup()
806
807 if self._safe_to_dynamically_spawn_children:
808 self._adjust_process_count()
809 self._start_executor_manager_thread()
810 return f
811 submit.__doc__ = _base.Executor.submit.__doc__
812
813 def map(self, fn, *iterables, timeout=None, chunksize=1):

Callers 1

Calls 6

_adjust_process_countMethod · 0.95
BrokenProcessPoolClass · 0.85
_WorkItemClass · 0.70
putMethod · 0.45
wakeupMethod · 0.45

Tested by 1