Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harvester Core blocks terminating the main script while it's acquiring images. #40

Closed
kazunarikudo opened this issue Sep 8, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@kazunarikudo
Copy link
Member

kazunarikudo commented Sep 8, 2018

Describe the bug
Harvester Core blocks terminating the main script while it's acquiring images.

To Reproduce
Steps to reproduce the behavior:

  1. Launch a Python interpreter.
  2. Prepare an image acquisition manager.
  3. Start image acquisition.
  4. Strike Ctrl+c.
  5. You'll see the interpreter doesn't terminate.

Expected behavior
Signaling an event such as Ctrl+c, Harvester Core should gracefully terminate itself even if it's acquiring images or not.

Screenshots
None.

Desktop (please complete the following information):
None.

Additional context
None.

@kazunarikudo kazunarikudo added the bug Something isn't working label Sep 8, 2018
kazunarikudo added a commit that referenced this issue Sep 8, 2018
Having this change, an ImageAcquisitionManager object handles the SIGINT
signal caused by `Ctrl+c` and it gracefully terminates threads and call
sys.exit(0) once it's triggered by the signal.
@kazunarikudo
Copy link
Member Author

I've made some improvements to the design at d97e831. I'll wait for feedback from a user. If the improvements meet his expectation, I'll close this issue.

kazunarikudo added a commit that referenced this issue Oct 8, 2018
If Harvester is running in the interactive mode, there’s no way to catch
the timing where quit() was called (then the SystemExit exception is
raised) because the responsibility is on the interactive interpreter side
such as Python or IPython. It means we can’t stop our threads by
ourselves. To avoid this situation happens, we create daemon threads
instead of non-daemon threads. This means we can’t explicitly be
responsible for cleaning up our responsible objects but at least we are
sure that our threads will never block the interpreter exits because
they're daemon threads.

This change may be relevant to the following issues:

#40
#47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant