[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: Function stopping a function
From:       "Sergio Correia" <sergio.correia () gmail ! com>
Date:       2007-11-23 6:18:59
Message-ID: f1aa6d810711222218l76fc3300h6400b1ed9ff55450 () mail ! gmail ! com
[Download RAW message or body]

If you are talking about events and all that, I suppose you are using
(or should be using) threads.

Why don't try running the length_function as  a Thread that on every
loop checks a semaphore and if the condition is met, exits itself?
Kinda like this:
http://mail.python.org/pipermail/python-list/2006-January/362138.html

HTH, Sergio

PS: Note the "try..." in my reply. I've never done this, so I'm not
sure it's going to work. Wiser people in the list will probably give
you better replies.


On Nov 22, 2007 11:30 PM, Sorin Schwimmer <sxn02@yahoo.com> wrote:
> Hi All,
>
> We all know that a function can launch the execution
> of another function. How can a function stop the
> execution of another function?
>
> For instance, lenghty_function() executes, when an
> external event triggers cancel(), which is supposed to
> abruptly stop lengthy_function(), reset some variables
> and exit immediately.
>
> Thanks for your advice
> SxN
>
>
>       ____________________________________________________________________________________
> Be a better sports nut!  Let your teams follow you
> with Yahoo Mobile. Try it now.  http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic