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

void PSafeCollection::RemoveAll ( BOOL  synchronous = FALSE ) [virtual, inherited]

Remove all objects in collection.

Parameters:
synchronousWait till objects are deleted before returning

Definition at line 313 of file safecoll.cxx.

References PSafeCollection::DeleteObjectsToBeRemoved(), PContainer::GetSize(), PCollection::RemoveAt(), PSync::Signal(), PThread::Sleep(), and PSync::Wait().

{
  collectionMutex.Wait();

  while (collection->GetSize() > 0)
    SafeRemoveObject(PDownCast(PSafeObject, collection->RemoveAt(0)));

  collectionMutex.Signal();

  if (synchronous) {
    // Have unfortunate busy loop here, but it should be very
    // rare that it will be here for long
    while (!DeleteObjectsToBeRemoved())
      PThread::Sleep(100);
  }
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index