Kyoto Cabinet
Classes | Public Member Functions
kyotocabinet::CondMap Class Reference

Assosiative condition variable. More...

#include <kcthread.h>

List of all members.

Classes

struct  Count
 Counter for waiting threads.
struct  Slot
 Slot of a key space.

Public Member Functions

 CondMap ()
 Default constructor.
 ~CondMap ()
 Destructor.
bool wait (const char *kbuf, size_t ksiz, double sec=-1)
 Wait for a signal.
bool wait (const std::string &key, double sec=-1)
 Wait for a signal by a key.
size_t signal (const char *kbuf, size_t ksiz)
 Send a wake-up signal to another thread waiting by a key.
size_t signal (const std::string &key)
 Send a wake-up signal to another thread waiting by a key.
size_t broadcast (const char *kbuf, size_t ksiz)
 Send wake-up signals to all threads waiting by a key.
size_t broadcast (const std::string &key)
 Send wake-up signals to all threads waiting by a key.
size_t broadcast_all ()
 Send wake-up signals to all threads waiting by each key.
size_t count ()
 Get the total number of threads waiting for signals.

Detailed Description

Assosiative condition variable.


Constructor & Destructor Documentation

Default constructor.

Destructor.


Member Function Documentation

bool kyotocabinet::CondMap::wait ( const char *  kbuf,
size_t  ksiz,
double  sec = -1 
)

Wait for a signal.

Parameters:
kbufthe pointer to the key region.
ksizthe size of the key region.
secthe interval of the suspension in seconds. If it is negative, no timeout is specified.
Returns:
true on catched signal, or false on timeout.
bool kyotocabinet::CondMap::wait ( const std::string &  key,
double  sec = -1 
)

Wait for a signal by a key.

Parameters:
keythe key.
secthe interval of the suspension in seconds. If it is negative, no timeout is specified.
Returns:
true on catched signal, or false on timeout.
size_t kyotocabinet::CondMap::signal ( const char *  kbuf,
size_t  ksiz 
)

Send a wake-up signal to another thread waiting by a key.

Parameters:
kbufthe pointer to the key region.
ksizthe size of the key region.
Returns:
the number of threads waiting for the signal.
size_t kyotocabinet::CondMap::signal ( const std::string &  key)

Send a wake-up signal to another thread waiting by a key.

Parameters:
keythe key.
Returns:
the number of threads waiting for the signal.
size_t kyotocabinet::CondMap::broadcast ( const char *  kbuf,
size_t  ksiz 
)

Send wake-up signals to all threads waiting by a key.

Parameters:
kbufthe pointer to the key region.
ksizthe size of the key region.
Returns:
the number of threads waiting for the signal.
size_t kyotocabinet::CondMap::broadcast ( const std::string &  key)

Send wake-up signals to all threads waiting by a key.

Parameters:
keythe key.
Returns:
the number of threads waiting for the signal.

Send wake-up signals to all threads waiting by each key.

Returns:
the number of threads waiting for the signal.

Get the total number of threads waiting for signals.

Returns:
the total number of threads waiting for signals.