On Feb 16, 2006, at 10:26 AM, Mike Orr wrote:

>
> On 2/16/06, Kevin Dangoor <[EMAIL PROTECTED]> wrote:
>>
>> On 2/15/06, Mike Orr <[EMAIL PROTECTED]> wrote:
>>> Then I discovered if the server is not handling a request, pressing
>>> ctrl-C quits all the threads.  But if it is handling a request, the
>>> threads remain.  If I then press Stop in the browser, the threads
>>> still remain, and I have to kill them.  Whereas if I kill the  
>>> threads
>>> with extreme prejudice, the browser suddenly times out.
>>>
>>> I'd expected the threads to just halt when I press ctrl-C and the
>>> browser to time out immediately.  But I haven't used a multithreaded
>>> framework for a while so I'm not sure this is possible.  Still, the
>>> main thread can tell the others to hurry up and exit, no?
>>
>> You can use a global variable that tells the other threads to exit
>> when they get around to it. I don't know of a way for the "main
>> thread" to "kill" the other threads.
>
> That's one thing I never understood.  Java does it, but Python claims
> it's impossible.

You can send an exception to a thread from the another thread, but  
only from the C API (because the behavior is relatively dangerous).   
It probably wouldn't help much in this case anyway, because any C  
function (e.g. socket or database call) is going to block until it  
returns back to Python.

-bob


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to