Re: Spawing a thread and printing dots until it finishes

2008-04-24 Thread sophie_newbie
On Apr 24, 12:32 pm, sophie_newbie <[EMAIL PROTECTED]> wrote: > On Apr 22, 3:10 pm,sophie_newbie<[EMAIL PROTECTED]> wrote: > > > > > Hi, I'm trying to write a piece of code that spawns a thread and > > prints dots every half second until the thread spawned is finished. > > Code is > > something lik

Re: Spawing a thread and printing dots until it finishes

2008-04-24 Thread sophie_newbie
On Apr 22, 3:10 pm, sophie_newbie <[EMAIL PROTECTED]> wrote: > Hi, I'm trying to write a piece of code that spawns a thread and > prints dots every half second until the thread spawned is finished. > Code is > something like this: > > import threading > class MyThread ( threading.Thread ): >

Re: Spawing a thread and printing dots until it finishes

2008-04-22 Thread Diez B. Roggisch
Larry Bates schrieb: sophie_newbie wrote: On Apr 22, 4:41 pm, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: On Tue, 22 Apr 2008 07:10:07 -0700 (PDT) sophie_newbie<[EMAIL PROTECTED]> wrote: import threading class MyThread ( threading.Thread ): def run ( self ): myLong

Re: Spawing a thread and printing dots until it finishes

2008-04-22 Thread Diez B. Roggisch
I think that there are two things that you need to wrap your head around before understanding what is happening here. First, threads are NOT pre-emptive. Unless your thread gives up the processor it will run forever. The sleep call is one way to give up the processor. That is not correct, at

Re: Spawing a thread and printing dots until it finishes

2008-04-22 Thread Larry Bates
sophie_newbie wrote: On Apr 22, 4:41 pm, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: On Tue, 22 Apr 2008 07:10:07 -0700 (PDT) sophie_newbie<[EMAIL PROTECTED]> wrote: import threading class MyThread ( threading.Thread ): def run ( self ): myLongCommand()... import ti

Re: Spawing a thread and printing dots until it finishes

2008-04-22 Thread Gabriel Genellina
En Tue, 22 Apr 2008 13:32:38 -0300, sophie_newbie <[EMAIL PROTECTED]> escribió: > On Apr 22, 4:41 pm, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: >> On Tue, 22 Apr 2008 07:10:07 -0700 (PDT) >> sophie_newbie<[EMAIL PROTECTED]> wrote: >> > import threading >> > class MyThread ( threading.Thread ):

Re: Spawing a thread and printing dots until it finishes

2008-04-22 Thread D'Arcy J.M. Cain
On Tue, 22 Apr 2008 09:32:38 -0700 (PDT) sophie_newbie <[EMAIL PROTECTED]> wrote: > On Apr 22, 4:41 pm, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: > > We know that your main routine gives up the processor but without a > > full definition of MyThread how do we know that it ever does? I > > susp

Re: Spawing a thread and printing dots until it finishes

2008-04-22 Thread sophie_newbie
On Apr 22, 4:41 pm, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: > On Tue, 22 Apr 2008 07:10:07 -0700 (PDT) > > > > sophie_newbie<[EMAIL PROTECTED]> wrote: > > import threading > > class MyThread ( threading.Thread ): > > def run ( self ): > > myLongCommand()... > > > impor

Re: Spawing a thread and printing dots until it finishes

2008-04-22 Thread D'Arcy J.M. Cain
On Tue, 22 Apr 2008 07:10:07 -0700 (PDT) sophie_newbie <[EMAIL PROTECTED]> wrote: > import threading > class MyThread ( threading.Thread ): > def run ( self ): > myLongCommand()... > > import time > > t = MyThread() > t.start() > > while t.isAlive(): > print "." >

Spawing a thread and printing dots until it finishes

2008-04-22 Thread sophie_newbie
Hi, I'm trying to write a piece of code that spawns a thread and prints dots every half second until the thread spawned is finished. Code is something like this: import threading class MyThread ( threading.Thread ): def run ( self ): myLongCommand()... import time t = MyT