#include <dispatcher.h>
Public Member Functions | |
dispatcher () | |
constructs the dispatcher | |
virtual | ~dispatcher ()=0 |
virtual void | send (tunnel_context_base *context) |
puts the tunnel context into the list of messages to dispatch | |
gint | queued_contexts () const |
threadhandle_type | creator_thread () const |
Static Public Attributes | |
static bool | deadlock_detection = false |
Whether deadlock detection is turned on. | |
Protected Member Functions | |
bool | process_next () |
processes the next message in the queue. | |
void | test_calling_thread () |
A dispatcher holds a list of pointers to sigx::tunnel_context objects.
2006-08-27, kj derive from operator_new to ensure heap allocation in the glibmmx module
2006-09-02, kj added deadlock detection: throw an exception if a thread sends a synchronous message to itself or to a thread that in turn has a synchronous message pending to the sending thread
sigx::dispatcher::dispatcher | ( | ) |
constructs the dispatcher
sigx::dispatcher::~dispatcher | ( | ) | [pure virtual] |
threadhandle_type sigx::dispatcher::creator_thread | ( | ) | const [inline] |
bool sigx::dispatcher::process_next | ( | ) | [protected] |
processes the next message in the queue.
References sigx::tunnel_context_base::creator_thread(), deadlock_detection, sigx::tunnel_context_base::invoke(), sigx::tunnel_context_base::is_sync(), sigx::tunnel_context_base::is_valid(), and sigx::dld::make_thread_pair().
Referenced by sigx::glib_dispatcher::~glib_dispatcher().
gint sigx::dispatcher::queued_contexts | ( | ) | const |
void sigx::dispatcher::send | ( | tunnel_context_base * | context | ) | [virtual] |
puts the tunnel context into the list of messages to dispatch
Reimplemented in sigx::glib_dispatcher.
References deadlock_detection, sigx::tunnel_context_base::is_sync(), and sigx::dld::make_thread_pair().
void sigx::dispatcher::test_calling_thread | ( | ) | [protected] |
bool sigx::dispatcher::deadlock_detection = false [static] |
Whether deadlock detection is turned on.
Set to `true" from the main thread (e.g. after Glib::thread_init()) to turn on the deadlock detection feature at runtime for synchronous messages. Defaults to false.
Deadlock detection comes with the price of performance there happens additional synchronization between threads. Use it mainly in the debug mode of your program.
Referenced by process_next(), and send().