Interrput a thread

Tim Roberts timr at probo.com
Sun Jan 2 19:50:56 EST 2011


gervaz <gervaz at gmail.com> wrote:
>
>Ok, but then suppose I have multiple long running threads that I want
>to delete/suspend because they are tooking too much time, which
>solution do you propose?

The right solution is to write your threads so they have an escape hatch --
to periodically check a "should I die?" flag, and then commit suicide. That
is the ONLY clean way to handle this problem.  There is simply no clean way
to force another thread to die without its permission.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list