On Sat, 11 Aug 2012 11:24:48 +0200, Hans Mulder wrote: > On 11/08/12 09:07:51, pozz wrote:
>> When the main thread wants to close the serial port, the receiving >> thread can be killed > > > How would you do that? > > IFAIK, there is no way in Python to kill a thread. Correct. > The usual work-around is to have a global flag that you'd set to True > when the main thread wants to close the port. The read would have a > timeout of 1 second of so, so that the reading thread is woken up every > second, so it can check that flag and wind up when the flag is set. It doesn't need to be a global flag. You can make the flag an attribute of the thread, and then have the thread check self.flag. -- Steven -- http://mail.python.org/mailman/listinfo/python-list