Killing subservient threads
koranthala
koranthala at gmail.com
Fri Feb 20 12:22:36 EST 2009
On Feb 20, 9:47 pm, jimzat <jim... at iname.com> wrote:
> I am trying to create an app which will have a main window from which
> the user will launch other (children) windows.
>
> When I launch the child window I start a new thread which periodically
> polls another device and updates the child window accordingly. When I
> dismiss the child window the "polling" thread stays alive and then
> crashes with an exception when trying to write to the now defunct
> child window.
>
> How can I handle this? I want to either 1) have the destructor for
> the child window kill the spawned thread or 2) catch the exception
> within the "polling" thread and see that the child window is gone and
> then commit suicide.
>
> I am an experienced embedded C programmer but have VERY little
> experience with GUI programming and no experience in the Micro$oft
> programming world.
thread.setDaemon(True)
Makes it a daemon thread which means that interpreter will not stay
alive if only that thread is alive.
More information about the Python-list
mailing list