(self, fn, done_callback, args, kwargs, high_priority)
| 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) |
no test coverage detected