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

bool GSafeFlags::test_and_modify ( long  set_mask,
long  clr_mask,
long  set_mask1,
long  clr_mask1 
)

If all bits mentioned in set_mask# are set in the flags and all bits mentioned in clr_mask# are cleared in the flags, it sets all bits from set_mask1# in the flags, clears all flags from clr_mask1# in the flags and returns TRUE#. Otherwise returns FALSE#.

Definition at line 1843 of file GThreads.cpp.

References GMonitor::broadcast(), GMonitor::enter(), and GMonitor::leave().

Referenced by modify(), operator &=(), and operator|=().

{
   enter();
   if ((flags & set_mask)==set_mask &&
       (~flags & clr_mask)==clr_mask)
   {
      long new_flags=flags;
      new_flags|=set_mask1;
      new_flags&=~clr_mask1;
      if (new_flags!=flags)
      {
       flags=new_flags;
       broadcast();
      }
      leave();
      return true;
   }
   leave();
   return false;
}


Generated by  Doxygen 1.6.0   Back to index