# PIntCondMutex Class Reference

This is a PCondMutex for which the conditional is the value of an integer. More...

`#include <syncthrd.h>`

Inheritance diagram for PIntCondMutex:

List of all members.

## Construction

enum | Operation { LT, LE, EQ, GE, GT }
| defines possible operators on current value and target value More...
| PIntCondMutex (int value=0, int target=0, Operation operation=LE)
| Create a cond mutex using an integer.

## Public Member Functions

Overrides from class PObject
void | PrintOn (ostream &strm) const
| Print the object on the stream.
Condition access functions
virtual PBoolean | Condition ()
| This is the condition that must be met for the WaitCondition() function to acquire the mutex.
| operator int () const
| Get the current value of the condition variable.
PIntCondMutex & | operator= (int newval)
| Assign new condition value.
PIntCondMutex & | operator++ ()
| Increment condition value.
PIntCondMutex & | operator+= (int inc)
| Add to condition value.
PIntCondMutex & | operator-- ()
| Decrement condition value.
PIntCondMutex & | operator-= (int dec)
| Subtract from condition value.

## Protected Attributes

int | value
int | target
Operation | operation

## Detailed Description

This is a PCondMutex for which the conditional is the value of an integer.

## Member Enumeration Documentation

enum PIntCondMutex::Operation

defines possible operators on current value and target value

Enumerator:

  LT | Less than.
  LE | Less than or equal to.
  EQ | Equal to.
  GE | Greater than or equal to.
  GT | Greater than.

## Constructor & Destructor Documentation

PIntCondMutex::PIntCondMutex | ( | int | value = `0`,
|  | int | target = `0`,
|  | Operation | operation = `LE` |
| ) |  |  |

Create a cond mutex using an integer.

Parameters:

  value | initial value if the integer
  target | target vaue which causes the mutex to unlock
  operation | comparison operator

## Member Function Documentation

virtual PBoolean PIntCondMutex::Condition | ( |  | ) | `[virtual]`

This is the condition that must be met for the WaitCondition() function to acquire the mutex.

Returns:
  true if condition is met.

Implements PCondMutex.

PIntCondMutex::operator int | ( |  | ) | const`[inline]`

Get the current value of the condition variable.

Returns:
  Current condition variable value.

PIntCondMutex& PIntCondMutex::operator++ | ( |  | ) |

Increment condition value.

Use the Wait() function to acquire the mutex, modify the value, then release the mutex, possibly releasing the thread in the WaitCondition() function if the condition was met by the operation.

Returns:
  The object reference for consecutive operations in the same statement.

PIntCondMutex& PIntCondMutex::operator+= | ( | int | inc | ) |

Add to condition value.

Use the Wait() function to acquire the mutex, modify the value, then release the mutex, possibly releasing the thread in the WaitCondition() function if the condition was met by the operation.

Returns:
  The object reference for consecutive operations in the same statement.

PIntCondMutex& PIntCondMutex::operator-- | ( |  | ) |

Decrement condition value.

Use the Wait() function to acquire the mutex, modify the value, then release the mutex, possibly releasing the thread in the WaitCondition() function if the condition was met by the operation.

Returns:
  The object reference for consecutive operations in the same statement.

PIntCondMutex& PIntCondMutex::operator-= | ( | int | dec | ) |

Subtract from condition value.

Use the Wait() function to acquire the mutex, modify the value, then release the mutex, possibly releasing the thread in the WaitCondition() function if the condition was met by the operation.

Returns:
  The object reference for consecutive operations in the same statement.

PIntCondMutex& PIntCondMutex::operator= | ( | int | newval | ) |

Assign new condition value.

Use the Wait() function to acquire the mutex, modify the value, then release the mutex, possibly releasing the thread in the WaitCondition() function if the condition was met by the operation.

Returns:
  The object reference for consecutive operations in the same statement.

void PIntCondMutex::PrintOn | ( | ostream & | strm | ) | const

Print the object on the stream.

This will be of the form #"(value < target)"#.

## Member Data Documentation

Operation PIntCondMutex::operation `[protected]`

int PIntCondMutex::target `[protected]`

int PIntCondMutex::value `[protected]`

The documentation for this class was generated from the following file:

- syncthrd.h