| 446 | work_item.future.set_result(result_item.result) |
| 447 | |
| 448 | def is_shutting_down(self): |
| 449 | # Check whether we should start shutting down the executor. |
| 450 | executor = self.executor_reference() |
| 451 | # No more work items can be added if: |
| 452 | # - The interpreter is shutting down OR |
| 453 | # - The executor that owns this worker has been collected OR |
| 454 | # - The executor that owns this worker has been shutdown. |
| 455 | return (_global_shutdown or executor is None |
| 456 | or executor._shutdown_thread) |
| 457 | |
| 458 | def _terminate_broken(self, cause): |
| 459 | # Terminate the executor because it is in a broken state. The cause |