Logo Search packages:      
Sourcecode: djvulibre version File versions

void DataPool::stop ( bool  only_blocked = false  ) 

Tells the DataPool# to stop serving readers.

If only_blocked# flag is TRUE# then only those requests will be processed, which would not block. Any attempt to get non-existing data would result in a STOP# exception (instead of blocking until data is available).

If only_blocked# flag is FALSE# then any further attempt to read from this DataPool# (as well as from any DataPool# connected to this one) will result in a STOP# exception.

Definition at line 1351 of file DataPool.cpp.

References GThread::yield().

{
   DEBUG_MSG("DataPool::stop(): Stopping this and dependent DataPools, only_blocked="
           << only_blocked << "\n");
   DEBUG_MAKE_INDENT(3);

   if (only_blocked) stop_blocked_flag=true;
   else stop_flag=true;
   

   wake_up_all_readers();

      // Now let all readers, which already go thru to the master DataPool,
      // come back and reenter. While reentering some of them will go
      // thru this DataPool again and will be stopped (DataPool::Stop exception)
      // Others (which entered the master DataPool thru other slave DataPools)
      // will simply continue waiting for their data.
   if (pool)
   {
       // This loop is necessary because there may be another thread, which
       // is going down thru the DataPool chain and did not reach the
       // lowest "master" DataPool yet. Since it didn't reach it yet,
       // the "pool->restart_readers()" will not restart it. So we're going
       // to continue issuing this command until we get rid of all
       // "active_readers"
      while(*active_readers)
      {
#if (THREADMODEL==COTHREADS) || (THREADMODEL==MACTHREADS)
       GThread::yield();
#endif
       pool->restart_readers();
      }
   }
}


Generated by  Doxygen 1.6.0   Back to index