Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | Class Members | Related Pages

SigCX::ThreadTunnel Class Reference
[SigC++ Extras]

A inter-thread tunnel. More...

#include <thread_tunnel.h>

Inheritance diagram for SigCX::ThreadTunnel:

SigCX::Tunnel List of all members.

Public Types

enum  Mode { NewThread, CurrentThread, SingleThread }

Public Member Functions

 ThreadTunnel (Dispatcher &disp, Mode mode=NewThread)
Dispatcherdispatcher ()
virtual void send (Callback *cb, bool sync=false)
virtual bool in_sync_callback ()
virtual void drain ()

Classes

class  FatalError
 Exception class. More...

Detailed Description

A inter-thread tunnel.

This tunnel is implemented using a pipe to transfer callbacks from one thread to another. It also has a single-threaded mode in which it uses the pipe anyway. This can be used to code nearly non-blocking UIs without the use of threads.


Member Enumeration Documentation

enum SigCX::ThreadTunnel::Mode
 

Execution mode of the ThreadTunnel.

Enumeration values:
NewThread  Run dispatcher in newly created thread.
CurrentThread  The dispatcher will run in current thread.

No thread will be created, and the callbacks are deferred until the next iteration of the dispatchers main loop.

SingleThread  This is similiar to CurrentThread, but for use in a single threaded program.


Constructor & Destructor Documentation

SigCX::ThreadTunnel::ThreadTunnel Dispatcher disp,
Mode  mode = NewThread
 

Constructor.

Parameters:
disp Dispatcher to use for the destination thread (working thread, the thread where the callbacks are executed).
mode Working mode of the dispatcher.


Member Function Documentation

Dispatcher& SigCX::ThreadTunnel::dispatcher  )  [inline]
 

Get the destination thread dispatcher.

Returns:
The destination thread dispatcher.

virtual void SigCX::ThreadTunnel::drain  )  [virtual]
 

Drain the tunnel.

Any callbacks in the tunnel are cancelled. This is intended to be called at the destination end of the tunnel.

Implements SigCX::Tunnel.

virtual bool SigCX::ThreadTunnel::in_sync_callback  )  [virtual]
 

Check if tunnel is executing a synchronous callback.

Returns:
true if a synchronous callback is in execution.

Implements SigCX::Tunnel.

virtual void SigCX::ThreadTunnel::send Callback *  cb,
bool  sync = false
[virtual]
 

Send a callback to the other side.

Parameters:
cb Callback to be executed on the other side of the tunnel.
sync If true, this thread is suspended until the callback has finished execution.

Implements SigCX::Tunnel.


The documentation for this class was generated from the following file:
Generated on Sun Apr 10 18:35:43 2005 for SigCX - SigC++ Extras by  doxygen 1.4.2