Diving into the Details

In this section, I will sketch the concepts of SigCX, giving you an understanding how things work.

The threading model

SigCX provides a full API for threads, including classes for threads and various means of synchronisation (condition, mutex, semaphore) and a way to create thread-private data.

In the following, the concepts are described:

The Dispatcher concept

A dispatcher is a facility where one can register handlers for various events and that invokes the handlers if these events happen. The dispatcher class in SigCX has support for input, output and exception handlers on file descriptors, timeout handlers and handlers for signals (those issued by raise()).

The Tunnel concept

A SigCX tunnel is a device that has a source and destination end. It allows callbacks to be sent from the source to the destination end. As callbacks are received by the destination end, they are invoked (executed) in the order they are sent. Normally the callbacks are executed asynchronously, that means when you send a callback, you regain control immediatly. If this behaviour is not intended, e.g. you have to wait for the callbacks' result, you can tell the tunnel to execute the callback synchronously and have the send primitive wait until the callback has finished execution.

Tunnels can be used to establish communication channels between concurrent parts of the program, like between two threads. There is a ThreadTunnel class in SigCX for this purpose. It is implemented using a UNIX pipe to transfer the callbacks from one thread to the other. But this class can also be used in single-threaded applications, where the callbacks can be defered until the dispatcher of the application handles them.

Go to the previous section or return to the index.


Generated on Mon Sep 10 06:27:37 2007 for SigCX - SigC++ Extras by  doxygen 1.5.3