tino / pyFirmata

Python interface for the Firmata (http://firmata.org/) protocol. It is compliant with Firmata 2.1. Any help with updating to 2.2 is welcome. The Capability Query is implemented, but the Pin State Query feature not yet.
MIT License
578 stars 191 forks source link

Fix `Iterator` thread to exit properly #41

Closed jochasinga closed 9 years ago

jochasinga commented 9 years ago

As per this issue I have added self.daemon = True to Iterator's constructor thus upon the termination of the main thread the daemon thread will die.

>>> it = util.Iterator(board)
>>> it.start()
>>> it.is_alive()    # -> True
>>> quit()           # Used to hang, now terminates

The entire Python program exits when no alive non-daemon threads are left. https://docs.python.org/3/library/threading.html#threading.Thread.daemon

tino commented 9 years ago

Hi, please make a pull request for a single issue. The spark-core layout has nothing to do with the iterator fix (which I would like to merge). Could you open a new, clean, pull-request?

(I am not in favour of adding more board layouts to boards.py, especially non-arduino boards. It is easy enough to add them in your own code, or use the board detection feature).

jochasinga commented 9 years ago

Ok will do.

Panisuan Chasinga Interaction Designer Edlab, Teachers College Columbia University 525 West 120th Street New York, NY 10027

m: +1(347)609-2075

[image: My LinkedIn] http://www.linkedin.com/in/jochasinga/ [image: My Github] http://github.com/jochasinga [image: My Twitter ] http://twitter.com/jochasinga

On Sun, Aug 2, 2015 at 9:45 AM, Tino de Bruijn notifications@github.com wrote:

Hi, please make a pull request for a single issue. The spark-core layout has nothing to do with the iterator fix (which I would like to merge). Could you open a new, clean, pull-request?

(I am not in favour of adding more board layouts to boards.py, especially non-arduino boards. It is easy enough to add them in your own code, or use the board detection feature).

— Reply to this email directly or view it on GitHub https://github.com/tino/pyFirmata/pull/41#issuecomment-127025271.