EventSource Class Reference

#include <Pt/System/EventSource.h>

Sends Events to receivers in other threads. More...

Inherits NonCopyable.

Public Member Functions

 EventSource ()
 Default Constructor.
 
 ~EventSource ()
 Destructor.
 
void connect (EventSink &sink)
 Connect to an EventSink.
 
void disconnect (EventSink &sink)
 Disonnect from an EventSink.
 
void send (const Pt::Event &ev)
 Send the event to all connected sinks.
 
template<typename EventT >
void subscribe (EventSink &sink)
 Send events of a certain type to the sink.
 
template<typename EventT >
void unsubscribe (EventSink &sink)
 Do not send events of a certain type to the sink anymore.
 

Detailed Description

The Signal class is not thread-safe and can only be used for intra-thread communication. To pass Events between different threads use an EventSource instead, which synchronizes sending of events and connecting and disconnecting sinks appropriately.