sigx::dispatcher Class Reference
[Dispatching]

base class denoting the ability to dispatch messages between threads. More...

#include <dispatcher.h>

Inheritance diagram for sigx::dispatcher:

sigx::operator_new sigx::glib_dispatcher

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 ()

Detailed Description

base class denoting the ability to dispatch messages between threads.

A dispatcher holds a list of pointers to sigx::tunnel_context objects.

Note:
abstract, use one of the dispatcher implementations.
Date:
2006-08-12, kj moved m_exiting into StandardDispatcher because it is only needed there - a glib_dispatcher must be created and destroyed by the same thread

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


Constructor & Destructor Documentation

sigx::dispatcher::dispatcher (  ) 

constructs the dispatcher

sigx::dispatcher::~dispatcher (  )  [pure virtual]

Exceptions:
bad_caller 

References test_calling_thread().


Member Function Documentation

threadhandle_type sigx::dispatcher::creator_thread (  )  const [inline]

bool sigx::dispatcher::process_next (  )  [protected]

gint sigx::dispatcher::queued_contexts (  )  const

Returns:
the count of tunnel contexts in the queue

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]


Field Documentation

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.

Note:
Set this flag only once and avoid setting it at any other place than at program start up.

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().


The documentation for this class was generated from the following files:

Generated on Wed Jan 28 21:38:00 2009 for sigx++ by  doxygen 1.5.8