MCPcopy Index your code
hub / github.com/brmmm3/fastthreadpool / _submit

Method _submit

fastthreadpool/fastthreadpool.py:397–418  ·  view source on GitHub ↗
(self, fn, done_callback, args, kwargs, high_priority)

Source from the content-addressed store, hash-verified

395
396 #c cdef object _submit(self, fn, done_callback, args, kwargs, bint high_priority) except +:
397 def _submit(self, fn, done_callback, args, kwargs, high_priority): #p
398 #c cdef int child_cnt
399 if self._shutdown_children:
400 raise PoolStopped("Pool not running")
401 job = (fn, done_callback, args, kwargs)
402 if high_priority:
403 self._jobs_appendleft(job)
404 else:
405 self._jobs_append(job)
406 self._job_cnt.release()
407 child_cnt = len(self._children)
408 if (self._busy_cnt >= child_cnt) and (child_cnt < self.max_children):
409 thr_child = Thread(target=self._child, name=self.child_name_prefix + str(child_cnt))
410 thr_child.daemon = True
411 thr_child.tnum = child_cnt
412 if self.init_callback is not None:
413 self.init_callback(thr_child, *self.init_args)
414 self._children.append(thr_child)
415 thr_child.start()
416 if self.result_id:
417 return id(job)
418 return None
419
420 def submit(self, fn, *args, **kwargs):
421 return self._submit(fn, self.done_callback, args, kwargs, False)

Callers 7

submitMethod · 0.95
submit_doneMethod · 0.95
submit_firstMethod · 0.95
submit_done_firstMethod · 0.95
_submit_later_doMethod · 0.95
_schedule_doMethod · 0.95
mapMethod · 0.95

Calls 2

PoolStoppedClass · 0.85
releaseMethod · 0.80

Tested by

no test coverage detected