Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   threading module, call thread.interrupt_main() (http://www.velocityreviews.com/forums/t700838-threading-module-call-thread-interrupt_main.html)

找尋自己的一片天 10-08-2009 03:33 AM

threading module, call thread.interrupt_main()
 
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!!

--
※Post by command from 59-124-255-226.HINET-IP.
老鼠的**豪饕T洞˙電子佈告欄系統˙alexbbs.twbbs.org˙140.113.166.7

Simon Forman 10-08-2009 04:40 PM

Re: threading module, call thread.interrupt_main()
 
2009/10/7 找尋自己的一片天 <command.bbs@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 10-08-2009 05:18 PM

Re: threading module, call thread.interrupt_main()
 
En Thu, 08 Oct 2009 00:33:04 -0300, 找尋自己的一片天
<command.bbs@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 10-08-2009 05:18 PM

Re: threading module, call thread.interrupt_main()
 
En Thu, 08 Oct 2009 00:33:04 -0300, 找尋自己的一片天
<command.bbs@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 10-14-2009 03:44 AM

Re: threading module, call thread.interrupt_main()
 
En Thu, 08 Oct 2009 14:18:48 -0300, Gabriel Genellina
<gagsl-py2@yahoo.com.ar> escribi:
> En Thu, 08 Oct 2009 00:33:04 -0300, 找尋自己的一片天
> <command.bbs@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



All times are GMT. The time now is 05:02 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.