This PR introduces new methods TrySubmit and TrySubmitWait to provide a panic-safe way to submit tasks to the worker pool, providing clear and explicit way for users to handle the stopped state of the worker pool without breaking backward compatibility by changing existing behavior in a non-obvious for users way.
Tests have been added.
Examples and usage documentation for the new methods have been added to the README.
There is also suggested solution provided in https://github.com/gammazero/workerpool/pull/66, however IMHO it is not good, because it alters existing behavior in a non-obvious way where tasks might not be executed as expected, but instead become no-ops. So it's better to panic than do nothing in that case.
This PR introduces new methods TrySubmit and TrySubmitWait to provide a panic-safe way to submit tasks to the worker pool, providing clear and explicit way for users to handle the stopped state of the worker pool without breaking backward compatibility by changing existing behavior in a non-obvious for users way.
Note: