[Tutor] How to use threads ?
Mark Kels
mark.kels at gmail.com
Wed Mar 2 20:35:56 CET 2005
On Tue, 1 Mar 2005 12:25:37 -0800 (PST), Shitiz Bansal
<shitizb at yahoo.com> wrote:
>
> Here is a simple program
>
> class abc(threading.Thread):
> def __init__(self):
> threading.Thread.__init__(self)
> self.x=1 etc. etc.....
> self.cont_flag=1
> def run(self):
> while self.cont_flag:
> print self.x
> (you can set the self.cont_falg to zero
> whenever you wish to end the loop(and
> hence
> the thread., either
> here, or even from outside the thread.
> of course, it isnt necessary that your
> thread is a loop, it can be a finite
> function.)
>
Thanks alot !!
I think I got it ths time.
The only problem is that when I try to do it my thread doesnt closes.
When does a thread closes ?
Thanks again.
--
1. The day Microsoft makes something that doesn't suck is probably the
day they start making vacuum cleaners.
2. Unix is user friendly - it's just picky about it's friends.
3. Documentation is like sex: when it is good, it is very, very good.
And when it is bad, it is better than nothing. - Dick Brandon
More information about the Tutor
mailing list