Re: Another solution to How do I know when a thread quits?

2005-06-09 Thread Peter Hansen
Prashanth Ellina wrote: > Thanks for the code sample. I will try it out. I guess there is no > reliable way to get away with just the "threads" module. As "threading" is built on top of "thread", that statement seems wrong, but the real question you should ask yourself is why you want to use the

Re: Another solution to How do I know when a thread quits?

2005-06-09 Thread Prashanth Ellina
Hi, Thanks for the code sample. I will try it out. I guess there is no reliable way to get away with just the "threads" module. Thanks, Prashanth Ellina -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I know when a thread quits?

2005-06-09 Thread harold fellermann
On 07.06.2005, at 16:44, harold fellermann wrote: > import thread > > def parentThread() : > lock = thread.allocate_lock() > child = thread.start_new_thread(childThread,(parent,)) > lock.acquire() > > def childThread(parent) : > parent.lock.acquire() > do_something_w

Re:Another solution to How do I know when a thread quits?

2005-06-08 Thread Giovanni Tumiati
On Tue, 07 Jun 2005 09:41:16 -0400, Peter Hansen wrote: On Tue, 07 Jun 2005 06:28:33 -0700, Prashanth Ellina wrote: > Hi, > > I have used the low-level thread module to write a multi-threaded app. > > tid = thread.start_new_thread(process, ()) > tid is an integer thread ident. > > the thread

Re: How do I know when a thread quits?

2005-06-07 Thread dowskimania
I'm no threads expert, but if you use the higher-level "threading" module, you could try something like this: import threading import time def countToTen(): for i in range(1,11): print i time.sleep(0.5) child = threading.Thread(target=countToTen) class ma

Re: How do I know when a thread quits?

2005-06-07 Thread harold fellermann
we had some off-group mails. A summary is posted to improve the knowledge base of the list. Prashanth wrote: > Hi, > > I can use the threading module but I am just looking if there is a > reliable way using the thread module. > > If I use a lock... > Let us assume that the child thread has done

Re: How do I know when a thread quits?

2005-06-07 Thread Peter Hansen
Prashanth Ellina wrote: > I have used the low-level thread module to write a multi-threaded app. > > tid = thread.start_new_thread(process, ()) > tid is an integer thread ident. > > the thread takes around 10 seconds to finish processing. Meanwhile the > main thread finished execution and exits.

Re: How do I know when a thread quits?

2005-06-07 Thread harold fellermann
Hi, > I want a reliable way of knowing when the child > thread finished execution so that I can make the main thread wait till > then. > > Any ideas? use a lock. the subthread allocates the lock and releases it after processing. the main thread must wait until the lock is released. otherwiese, u

How do I know when a thread quits?

2005-06-07 Thread Prashanth Ellina
Hi, I have used the low-level thread module to write a multi-threaded app. tid = thread.start_new_thread(process, ()) tid is an integer thread ident. the thread takes around 10 seconds to finish processing. Meanwhile the main thread finished execution and exits. This causes an error because the