MCPcopy Index your code
hub / github.com/python/cpython / submit

Method submit

Lib/concurrent/futures/thread.py:199–216  ·  view source on GitHub ↗
(self, fn, /, *args, **kwargs)

Source from the content-addressed store, hash-verified

197 ("ThreadPoolExecutor-%d" % self._counter()))
198
199 def submit(self, fn, /, *args, **kwargs):
200 with self._shutdown_lock, _global_shutdown_lock:
201 if self._broken:
202 raise self.BROKEN(self._broken)
203
204 if self._shutdown:
205 raise RuntimeError('cannot schedule new futures after shutdown')
206 if _shutdown:
207 raise RuntimeError('cannot schedule new futures after '
208 'interpreter shutdown')
209
210 f = _base.Future()
211 task = self._resolve_work_item_task(fn, args, kwargs)
212 w = _WorkItem(f, task)
213
214 self._work_queue.put(w)
215 self._adjust_thread_count()
216 return f
217 submit.__doc__ = _base.Executor.submit.__doc__
218
219 def _adjust_thread_count(self):

Callers 6

gather_idsFunction · 0.95
run_in_executorMethod · 0.95
test_wrap_futureMethod · 0.95

Calls 3

_adjust_thread_countMethod · 0.95
_WorkItemClass · 0.70
putMethod · 0.45