[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ccrtp-devel] join function for Thread (OST)
From: |
Dan Weber |
Subject: |
Re: [Ccrtp-devel] join function for Thread (OST) |
Date: |
Mon, 28 Feb 2005 17:49:27 -0500 (EST) |
On Mon, 28 Feb 2005, David Sugar wrote:
join simply waits (blocks) until a thread exits or is canceled. Normally you
do not have to call join in your application at all; if you delete a Thread
derived object, if it's derived ~destructor invokes terminate(), then during
the delete, the target thread will be both canceled and joined for you
automatically. Usually it is best to put terminate() first in the derived
destructor, and any other cleanup code after that. The cleanup code will
then execute in the context of the thread that is initiating the delete, and
will happen after the target thread has stopped executing so there is no risk
of a resource still in use by the target thread.
What I usually do is use join for the mainthread of the application. In
my most recent application, Music On Hold, its very sip-centric, and I run
join on the SipStack thread.
Dan