-
Notifications
You must be signed in to change notification settings - Fork 193
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
Iterator zombie won't die :) #13
Comments
Hi, I think I've experienced this as well before, but I am not really familiar with all ins and outs of threads. Could you make a pull request out of this? |
Hi, this bug is due to I created a new pull request (#45) with some commits that fix this problem by implementing the support for the Python "with" statement, so you can do something like this:
and it will take care of creating the Iterator thread at the beginning of the with block and stopping it (automatically calling
I hope @tino likes the pull request and merges it soon :) |
Fix with #44 |
…en pyfirmata y la solucion en tino/pyFirmata#13
The Iterator thread doesn't die gracefully on KeyboardInterrupt or SystemExit, or when the Main thread completes.
Additionally, the function _Thread__stop() which does indeed kill the Iterator doesn't appear to be broken out to a nice function call, like Iterator.stop() as seems to be suggested within the Mockup implementation.
I propose setting the Iterator thread's isDaemon() flag to True in the Iterator constructor
If the developer chooses to call Iterator run() in the main thread (preventing the python interpreter from returning) they may need code like the following so it can be killed when foregrounded...
...and a simple extra method to map the stop function to Thread's stopping function could be nice...
The text was updated successfully, but these errors were encountered: