Function stopping a function

Sergio Correia sergio.correia at gmail.com
Fri Nov 23 01:18:59 EST 2007


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 at 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
>



More information about the Python-list mailing list