| 163 | self._initargs = initargs |
| 164 | |
| 165 | def submit(self, fn, /, *args, **kwargs): |
| 166 | with self._shutdown_lock, _global_shutdown_lock: |
| 167 | if self._broken: |
| 168 | raise BrokenThreadPool(self._broken) |
| 169 | |
| 170 | if self._shutdown: |
| 171 | raise RuntimeError('cannot schedule new futures after shutdown') |
| 172 | if _shutdown: |
| 173 | raise RuntimeError('cannot schedule new futures after ' |
| 174 | 'interpreter shutdown') |
| 175 | |
| 176 | f = _base.Future() |
| 177 | w = _WorkItem(f, fn, args, kwargs) |
| 178 | |
| 179 | self._work_queue.put(w) |
| 180 | self._adjust_thread_count() |
| 181 | return f |
| 182 | submit.__doc__ = _base.Executor.submit.__doc__ |
| 183 | |
| 184 | def _adjust_thread_count(self): |