Cyg_Flag::Cyg_Flag
Name: Cyg_Flag::Cyg_Flag ( ) - create flag
Synopsis:
Cyg_Flag::Cyg_Flag
(
  Cyg_FlagValue init=0 /* intial conditions */
)
Description: This creates a flag. Flags allow a thread to wait on a condition or a set of conditions. Each condition is represented by a bit. You can control which conditions are set on creation with "init".
Include: #include <cyg/kernel/flag.hxx>
Returns: nothing
See Also: Cyg_Flag::~Cyg_Flag

Cyg_Flag::~Cyg_Flag
Name: Cyg_Flag::~Cyg_Flag ( ) - destroy flag
Synopsis:
Cyg_Flag::~Cyg_Flag
(
  void
)
Description: Destroy a flag. Be careful not to destroy a flag still in use. If you destroy a flag with threads waiting on it, they will be awaken with a signal of Cyg_Thread::DESTRUCT, but this is bad programming practice. Avoid doing this.
Include: #include <cyg/kernel/flag.hxx>
Returns: nothing
See Also: Cyg_Flag::Cyg_Flag

Cyg_Flag::setbits
Name: Cyg_Flag::setbits ( ) - set bits in a flag
Synopsis:
void Cyg_Flag::setbits
(
  Cyg_FlagValue arg=~0 /* bits (conditions) to set */
);
Description: Sets bits (conditions) in the flag. Each bit represents a single condition.
Include: #include <cyg/kernel/flag.hxx>
Returns: nothing
See Also: Cyg_Flag::maskbits, Cyg_Flag::wait, Cyg_Flag::poll, Cyg_Flag::peek, Cyg_Flag::waiting

Cyg_Flag::maskbits
Name: Cyg_Flag::maskbits ( ) - clear bits in flag
Synopsis:
void Cyg_Flag::maskbits
(
  Cyg_FlagValue arg=0 /* bits (conditions) to clear */
)
Description: This clears bit (conditions) of the flag. Any bit that is set to 1 will not be cleared.
Include: #include <cyg/kernel/flag.hxx>
Returns: nothing
See Also: Cyg_Flag::setbits, Cyg_Flag::wait, Cyg_Flag::poll, Cyg_Flag::peek, Cyg_Flag::waiting

Cyg_Flag::wait
Name: Cyg_Flag::wait ( ) - wait on a a condition or set of conditions
Synopsis:
Cyg_FlagValue Cyg_Flag::wait
(
  Cyg_FlagValue pattern, /* bit pattern */
  WaitMode      mode     /* mode        */
)
Description: This waits on a set of conditions to be set. Once the conditions are met, it will wake the waiting thread. There are several modes that will affect which conditions must be set in order for the thread to wake up. They are:

Cyg_Flag::AND - wait for all conditions to be set in the pattern before waking the thread.

Cyg_Flag::OR - wait for any conditions in the pattern to be set before waking the thread.

Cyg_Flag::CLR - automatically clear the conditions that caused the calling thread to wake.

Cyg_Flag::MASK - clears all conditions set in the pattern

Include: #include <cyg/kernel/flag.hxx>
Returns: the flag value that succedded in waking the thread or 0 if there was an error such as a bad pattern or mode.
See Also: Cyg_Flag::setbits, Cyg_Flag::maskbits, Cyg_Flag::poll, Cyg_Flag::peek, Cyg_Flag::waiting

Cyg_Flag::wait
Name: Cyg_Flag::wait ( ) - wait on a a condition or set of conditions with a timeout
Synopsis:
Cyg_FlagValue Cyg_Flag::wait
(
  Cyg_FlagValue  pattern,    /* bit pattern      */
  WaitMode       mode,       /* mode             */
  cyg_tick_count abs_timeout /* absolute timeout */
)
Description: This waits on a set of conditions to be set or times out. Note that the timeout is in absolute, not relative time. Once the conditions are met or the wait expires, it will wake the waiting thread. There are several modes that will affect which conditions must be set in order for the thread to wake up. They are:

Cyg_Flag::AND - wait for all conditions to be set in the pattern before waking the thread.

Cyg_Flag::OR - wait for any conditions in the pattern to be set before waking the thread.

Cyg_Flag::CLR - automatically clear the conditions that caused the calling thread to wake.

Cyg_Flag::MASK - clears all conditions set in the pattern

Include: #include <cyg/kernel/flag.hxx>
Returns: the flag value that succedded in waking the thread or 0 if there was an error such as a bad pattern, bad mode, or timeout.
See Also: Cyg_Flag::setbits, Cyg_Flag::maskbits, Cyg_Flag::poll, Cyg_Flag::peek, Cyg_Flag::waiting

Cyg_Flag::poll
Name: Cyg_Flag::poll ( ) - test for a pattern match on the flag
Synopsis:
Cyg_FlagValue Cyg_Flag::poll
(
  Cyg_FlagValue pattern, /* bit pattern */
  WaitMode      mode     /* mode        */
)
Description: This checks a flag for the set of conditions but does not block. The possible modes are:

Cyg_Flag::AND - return match if all conditions in the pattern are set in the flag

Cyg_Flag::OR - return match if any of the conditions in the pattern are set in the flag.

Cyg_Flag::CLR - automatically clear the conditions that caused the calling thread to return a match, IF there was a match.

Cyg_Flag::MASK - clears all conditions set in the pattern if there was a match.

Include: #include <cyg/kernel/flag.hxx>
Returns: The pattern that caused the match or 0 if there was no match.
See Also: Cyg_Flag::setbits, Cyg_Flag::maskbits, Cyg_Flag::wait, Cyg_Flag::peek, Cyg_Flag::waiting

Cyg_Flag::peek
Name: Cyg_Flag::peek ( ) - get conditions set in a given flag
Synopsis:
Cyg_FlagValue Cyg_Flag::peek
(
  void
)
Description: This returns the conditions that are currently set in a flag.
Include: #include <cyg/kernel/flag.hxx>
Returns: the conditions that are set in a flag as a bitmask.
See Also: Cyg_Flag::setbits, Cyg_Flag::maskbits, Cyg_Flag::wait, Cyg_Flag::poll, Cyg_Flag::waiting

Cyg_Flag::waiting
Name: Cyg_Flag::waiting ( ) - check to see if any threads are waiting on flag
Synopsis:
cyg_bool Cyg_Flag::waiting
(
  void
)
Description: This is used to check to see if any threads are currently waiting on the flag.
Include: #include <cyg/kernel/flag.hxx>
Returns: "true" if thread are waiting on the flag, "false" is there are not threads waiting on the flag.
See Also: Cyg_Flag::setbits, Cyg_Flag::maskbits, Cyg_Flag::wait, Cyg_Flag::poll, Cyg_Flag::peek