How do you know when a thread has finished running? 
Author Message
 How do you know when a thread has finished running?

How do you know when a thread has finished running?

Currently I'm setting a semaphore as the last statement in the thread's Run
method, but this is a clunky and unsatisfactory way of doing it. Is there a
better way of knowing when it's running and when it's finished?

Best Regards,

Michael Wildoer
Lava Software Pty. Ltd.

http://www.*-*-*.com/



Tue, 03 Feb 2004 09:47:16 GMT  
 How do you know when a thread has finished running?

Quote:

> How do you know when a thread has finished running?

> Currently I'm setting a semaphore as the last statement in the thread's Run
> method, but this is a clunky and unsatisfactory way of doing it. Is there a
> better way of knowing when it's running and when it's finished?

In a word, no. I wouldn't set a semaphore if I were you; I'd just set a
globally available boolean somewhere. But it amounts to the same thing;
you're doing it right. This is all part of a large set of missing thread
features; for example, you can't kill a thread or sleep a thread, you
can't get a list of current threads, etc. m.

--

*** REALbasic, The Definitive Guide! ***
http://www.oreilly.com/catalog/realbasic/



Tue, 03 Feb 2004 12:50:57 GMT  
 How do you know when a thread has finished running?
Thanks, Matt! It's good to get an answer from such a definitive source as
yourself.

Looking forward to seeing the new edition of your book, "RealBasic: The
Definitive Guide". The current edition has been very useful indeed.

Quote:


> > How do you know when a thread has finished running?

> > Currently I'm setting a semaphore as the last statement in the thread's Run
> > method, but this is a clunky and unsatisfactory way of doing it. Is there a
> > better way of knowing when it's running and when it's finished?

> In a word, no. I wouldn't set a semaphore if I were you; I'd just set a
> globally available boolean somewhere. But it amounts to the same thing;
> you're doing it right. This is all part of a large set of missing thread
> features; for example, you can't kill a thread or sleep a thread, you
> can't get a list of current threads, etc. m.

> --

> *** REALbasic, The Definitive Guide! ***
> http://www.oreilly.com/catalog/realbasic/

--
Best Regards,

Michael Wildoer
Customer Support Services
Lava Software Pty. Ltd.
ACN: 078 013 902

GPO Box 215, Adelaide, Australia, 5001

http://www.lavasoft.com
fax: +618-8235-0668
tel: +618-8235-0003



Tue, 03 Feb 2004 15:00:26 GMT  
 How do you know when a thread has finished running?

wrote on 8/16/01 6:47 PM:

Quote:
> How do you know when a thread has finished running?

Besides setting a global variable at the end of the thread, you might call a
method of those objects that care if the thread is running to tell them it
just finished.

-Laz



Thu, 05 Feb 2004 10:42:06 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. how to know number of threads are running.

2. how do I know when popen() finishes?

3. In Tcl,how the parent process know the subprocess finished

4. Re Having trouble doing int 21/2521h

5. Threaded server doesn't run its threads

6. RUN used in program, but not waiting for process to finish

7. lighting Ive done / do you know other (complex) lighting examples

8. how to know if whole file is done loading

9. Testing, I know I keep doing it but I'm tesating :-)

10. having activetcl and thread tcl on linux

11. running Python-Skripts without having Python installed

12. ANNC: Tcl/Tk 8.4.1 done for threads for windows (binaries)

 

 
Powered by phpBB® Forum Software