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

BOOL PSafeCollection::DeleteObjectsToBeRemoved (  ) [virtual, inherited]

Delete any objects that have been removed. Returns TRUE if all objects in the collection have been removed and their pending deletions carried out.

Definition at line 341 of file safecoll.cxx.

References PSafeCollection::DeleteObject(), PContainer::IsEmpty(), PSync::Signal(), and PSync::Wait().

Referenced by DoSomeThing2::Main(), and PSafeCollection::RemoveAll().

{
  PWaitAndSignal lock(removalMutex);

  PINDEX i = 0;
  while (i < toBeRemoved.GetSize()) {
    if (toBeRemoved[i].SafelyCanBeDeleted()) {
      PObject * obj = toBeRemoved.RemoveAt(i);
      removalMutex.Signal();
      DeleteObject(obj);
      removalMutex.Wait();

      i = 0; // Restart looking through list
    }
    else
      i++;
  }

  return toBeRemoved.IsEmpty() && collection->IsEmpty();
}

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