Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

threading module, call thread.interrupt_main()

15 views
Skip to first unread message

��M�ۤv���@���

unread,
Oct 7, 2009, 11:33:04 PM10/7/09
to
Sorry to ask, but i don't know how to solve it.

I try to call thread.interrupt_main() function in my child thread's run method
which is inherit threading.Thread class.

But it didn't work, does anyone know why?

Thanks a lot!!

--
[1;36m嚙踝蕭Post by [37mcommand [36mfrom [33m59-124-255-226.HINET-IP. [m
[1;36m嚙諸對蕭嚙踝蕭嚙踝蕭嚙踝蕭嚙褐酪嚙罷 [31m嚙踝蕭 [33m嚙緬嚙締嚙瘦嚙箠嚙踝蕭t嚙踝蕭 [31m嚙踝蕭 [32malexbbs.twbbs.org [31m嚙踝蕭 [37m140.113.166.7 [m

Simon Forman

unread,
Oct 8, 2009, 12:40:37 PM10/8/09
to 找尋自己的一片天, pytho...@python.org
2009/10/7 找尋自己的一片天 <comma...@alexbbs.twbbs.org>:

> Sorry to ask, but i don't know how to solve it.
>
> I try to call thread.interrupt_main() function in my child thread's run method
> which is inherit threading.Thread class.
>
> But it didn't work, does anyone know why?
>
> Thanks a lot!!
>

"it didn't work" is not enough information.

What is your code (smallest version that shows the problem)?

And what is the traceback?

Gabriel Genellina

unread,
Oct 8, 2009, 1:18:48 PM10/8/09
to pytho...@python.org
En Thu, 08 Oct 2009 00:33:04 -0300, ᅵᅵMᅵۀvᅵᅵᅵ@ᅵᅵᅵ
<comma...@alexbbs.twbbs.org> escribiᅵ:

> Sorry to ask, but i don't know how to solve it.

No need to apologize!

> I try to call thread.interrupt_main() function in my child thread's run
> method
> which is inherit threading.Thread class.
>
> But it didn't work, does anyone know why?

Are you join()ing your child thread? In this case the main thread won't
acknowledge the exception until the join() call returns -- probably too
late. A sleep() call isn't interruptible either.

I think it's already reported at http://bugs.python.org but I can't locate
the issue right now.

--
Gabriel Genellina

Gabriel Genellina

unread,
Oct 8, 2009, 1:18:48 PM10/8/09
to pytho...@python.org
En Thu, 08 Oct 2009 00:33:04 -0300, ᅵᅵMᅵۀvᅵᅵᅵ@ᅵᅵᅵ
<comma...@alexbbs.twbbs.org> escribiᅵ:

> Sorry to ask, but i don't know how to solve it.

No need to apologize!

> I try to call thread.interrupt_main() function in my child thread's run
> method
> which is inherit threading.Thread class.
>
> But it didn't work, does anyone know why?

Are you join()ing your child thread? In this case the main thread won't

Gabriel Genellina

unread,
Oct 13, 2009, 11:44:59 PM10/13/09
to pytho...@python.org
En Thu, 08 Oct 2009 14:18:48 -0300, Gabriel Genellina
<gags...@yahoo.com.ar> escribiᅵ:

> En Thu, 08 Oct 2009 00:33:04 -0300, ᅵᅵMᅵۀvᅵᅵᅵ@ᅵᅵᅵ
> <comma...@alexbbs.twbbs.org> escribiᅵ:
>
>> I try to call thread.interrupt_main() function in my child thread's run
>> method
>> which is inherit threading.Thread class.
>> But it didn't work, does anyone know why?
>
> Are you join()ing your child thread? In this case the main thread won't
> acknowledge the exception until the join() call returns -- probably too
> late. A sleep() call isn't interruptible either.

Could you confirm if this was actually your problem? Or something
different?

--
Gabriel Genellina

0 new messages