Tkrzw
Classes | Public Member Functions | Friends | List of all members
tkrzw::KeySignalBroker< KEYTYPE > Class Template Referencefinal

Broker to send a signal associated with a key to another thread. More...

#include <tkrzw_thread_util.h>

Classes

class  Waiter
 Handler to wait for the signal. More...
 

Public Member Functions

 KeySignalBroker ()
 Default constructor. More...
 
bool Send (const KEYTYPE &key, bool all=true)
 Sends a signal identified by a key. More...
 

Friends

class Waiter
 

Detailed Description

template<typename KEYTYPE>
class tkrzw::KeySignalBroker< KEYTYPE >

Broker to send a signal associated with a key to another thread.

Constructor & Destructor Documentation

◆ KeySignalBroker()

template<typename KEYTYPE >
tkrzw::KeySignalBroker< KEYTYPE >::KeySignalBroker

Default constructor.

Member Function Documentation

◆ Send()

template<typename KEYTYPE >
bool tkrzw::KeySignalBroker< KEYTYPE >::Send ( const KEYTYPE &  key,
bool  all = true 
)

Sends a signal identified by a key.

Parameters
keyThe key of the signal.
allIf true, notification is sent to all waiting threads. If false, it is sent to only one waiting thread.
Returns
True if the signal is received by an waiting thread, or false if not.