# kyotocabinet::CondVar Class Reference

Condition variable. More...

`#include <kcthread.h>`

List of all members.

## Public Member Functions

| CondVar ()
| Default constructor.
| ~CondVar ()
| Destructor.
void | wait (Mutex *mutex)
| Wait for the signal.
bool | wait (Mutex *mutex, double sec)
| Wait for the signal.
void | signal ()
| Send the wake-up signal to another waiting thread.
void | broadcast ()
| Send the wake-up signals to all waiting threads.

## Detailed Description

Condition variable.

## Constructor & Destructor Documentation

kyotocabinet::CondVar::CondVar | ( |  | ) | `[explicit]`

Default constructor.

kyotocabinet::CondVar::~CondVar | ( |  | ) |

Destructor.

## Member Function Documentation

void kyotocabinet::CondVar::wait | ( | Mutex * | mutex | ) |

Wait for the signal.

Parameters:

  mutex | a locked mutex.

bool kyotocabinet::CondVar::wait | ( | Mutex * | mutex,
|  | double | sec
| ) |  |

Wait for the signal.

Parameters:

  mutex | a locked mutex.
  sec | the interval of the suspension in seconds.

Returns:
  true on catched signal, or false on timeout.

void kyotocabinet::CondVar::signal | ( |  | ) |

Send the wake-up signal to another waiting thread.

Note:
  The mutex used for the wait method should be locked by the caller.

void kyotocabinet::CondVar::broadcast | ( |  | ) |

Send the wake-up signals to all waiting threads.

Note:
  The mutex used for the wait method should be locked by the caller.