#include <QThread.h>
A very useful and commonly used form of wait condition is one combined with a count that signals when it reaches zero. You can think of it as similar to an inverse semaphore, but obviously it's not an exact fit because unlike semaphores there is no limit to the count.
By default, there is no checking of the count value for speed - however, you may enable checking for the count falling below zero. The exception is thrown with FXERRH_ISDEBUG and so is not language translated for the user's benefit.
Public Member Functions | |
FXZeroedWait (int initcount=0) | |
operator int () const | |
int | operator= (int i) |
int | operator++ (int) |
int | operator++ () |
int | operator+= (int i) |
int | operator-- (int) |
int | operator-- () |
int | operator-= (int i) |
bool | wait (FXuint time=FXINFINITE) |
void | setChecks (bool d) |
FX::FXZeroedWait::FXZeroedWait | ( | int | initcount = 0 |
) | [inline] |
Constructs a FXZeroedWait with initial count initcount.
FX::FXZeroedWait::operator int | ( | ) | const [inline] |
Returns the count.
int FX::FXZeroedWait::operator= | ( | int | i | ) | [inline] |
Sets the value of the count, which if zero frees any waiting threads.
int FX::FXZeroedWait::operator++ | ( | int | ) | [inline] |
Post-increments the count.
int FX::FXZeroedWait::operator++ | ( | ) | [inline] |
Pre-increments the count.
int FX::FXZeroedWait::operator+= | ( | int | i | ) | [inline] |
Increments the count by a given amount.
int FX::FXZeroedWait::operator-- | ( | int | ) | [inline] |
Post-decrements the count, which if zero frees any waiting threads.
int FX::FXZeroedWait::operator-- | ( | ) | [inline] |
Pre-decrements the count, which if zero frees any waiting threads.
int FX::FXZeroedWait::operator-= | ( | int | i | ) | [inline] |
Decrements the count by a given amount, which if zero frees any waiting threads.
bool FX::FXZeroedWait::wait | ( | FXuint | time = FXINFINITE |
) | [inline] |
Waits for the count to become zero, returning true if wait succeeds.
void FX::FXZeroedWait::setChecks | ( | bool | d | ) | [inline] |
Sets if run-time checks are performed on the count value.