class GSafeFlags: public GMonitor

A thread safe class representing a set of flags.

Inheritance:


Public Methods

[more] GSafeFlags(long flags=0)
Constructs GSafeFlags object.
[more]GSafeFlags& operator=(const GSafeFlags & f)
Assignment operator.
[more] operator long(void) const
Returns the value of the flags
[more]GSafeFlags& operator|=(long mask)
Modifies the flags by ORing them with the provided mask.
[more]GSafeFlags& operator&=(long mask)
Modifies the flags by ANDing them with the provided mask.
[more]bool 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.
[more]void wait_and_modify(long set_mask, long clr_mask, long set_mask1, long clr_mask1)
Waits until all bits mentioned in set_mask are set in the flags and all bits mentioned in clr_flags are cleared in the flags.
[more]void wait_for_flags(long set_mask, long clr_mask=0) const
Waits until all bits set in set_mask are set in the flags and all bits mentioned in clr_mask are cleared in the flags.
[more]void modify(long set_mask, long clr_mask)
Modifies the flags by setting all bits mentioned in set_mask and clearing all bits mentioned in clr_mask.


Inherited from GMonitor:

Public Methods

o GMonitorLock(GMonitor *gsec)
o ~GMonitorLock()


Documentation

A thread safe class representing a set of flags. The flags are protected by GMonitor, which is attempted to be locked whenever somebody accesses the flags. One can modify the class contents using one of two functions: test_and_modify() and wait_and_modify(). Both of them provide atomic operation of testing (first) and modification (second). The flags remain locked between the moment of testing and modification, which guarantees, that their state cannot be changed in between of these operations.
o GSafeFlags(long flags=0)
Constructs GSafeFlags object.

oGSafeFlags& operator=(const GSafeFlags & f)
Assignment operator. Will also wake up threads waiting for the flags to change.

o operator long(void) const
Returns the value of the flags

oGSafeFlags& operator|=(long mask)
Modifies the flags by ORing them with the provided mask. A broadcast will be sent after the modification is done.

oGSafeFlags& operator&=(long mask)
Modifies the flags by ANDing them with the provided mask. A broadcast will be sent after the modification is done.

obool 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.

ovoid wait_and_modify(long set_mask, long clr_mask, long set_mask1, long clr_mask1)
Waits until all bits mentioned in set_mask are set in the flags and all bits mentioned in clr_flags are cleared in the flags. After that it sets bits from set_mask1 and clears bits from clr_mask1 in the flags.

ovoid wait_for_flags(long set_mask, long clr_mask=0) const
Waits until all bits set in set_mask are set in the flags and all bits mentioned in clr_mask are cleared in the flags.

ovoid modify(long set_mask, long clr_mask)
Modifies the flags by setting all bits mentioned in set_mask and clearing all bits mentioned in clr_mask. If the flags have actually been modified, a broadcast will be sent.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java


DjVu is a trademark of LizardTech, Inc.
All other products mentioned are registered trademarks or trademarks of their respective companies.