Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

void PThread::SetAutoDelete ( AutoDeleteFlag  deletion = AutoDeleteThread ) [virtual, inherited]

Set the flag indicating thread object is to be automatically deleted when the thread ends.

Parameters:
deletionNew auto delete setting.

Definition at line 1399 of file win32.cxx.

References PThread::AutoDeleteThread, PThread::Current(), and PProcess::Current().

Referenced by PThread::SetNoAutoDelete().

{
  PAssert(deletion != AutoDeleteThread || this != &PProcess::Current(), PLogicError);

  PProcess & process = PProcess::Current();

  if (autoDelete && deletion != AutoDeleteThread) {
    process.deleteThreadMutex.Wait();
    process.autoDeleteThreads.DisallowDeleteObjects();
    process.autoDeleteThreads.Remove(this);
    process.autoDeleteThreads.AllowDeleteObjects();
    process.deleteThreadMutex.Signal();
  }
  else if (!autoDelete && deletion == AutoDeleteThread) {
    process.deleteThreadMutex.Wait();
    process.autoDeleteThreads.Append(this);
    process.deleteThreadMutex.Signal();
  }

  autoDelete = deletion == AutoDeleteThread;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index