namespace Impl

TSE3 private implementation namespace. More...

Internal Use Only
Full nameTSE3::Impl
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types


Detailed Description

Internal implementation namespace.

You can ignore the classes in this namespace. They are internal implementation details for the TSE3 library and are not part of the normal public API.

The contents include implementation details for the Notifier class and the Impl::Mutex classes which provide TSE3 thread-safety.

See also: Notifier, Listener

MutexImpl (class)

MutexImpl

This class provides an abtract interface for a mutex implementation.

The NullMutexImpl class inherits from this base class, and provides a 'null' implementation: performing no lock or unlock operations.

This class provides a way of specifying mutex behaviour in a platform independant manner.

If you want to use TSE3 in a thread-safe manner then you will need to implement a MutexImpl class and pass it to the Mutex class.

A MutexImpl is created in an unlocked state.

See also: Mutex

NullMutexImpl (class)

NullMutexImpl

A default, 'null' implementation of the MutexImpl class that is used by thread-unsafe versions of the TSE3 library.

The lock and unlock methods are essentially no-ops - they don't perform any locking whatsoever.

See also: MutexImpl

Mutex (class)

Mutex

The Mutex class is used by TSE3 to ensure thread safety. All potentially contenious TSE3 methods claim a Mutex to prevent TSE3 being entered by multiple threads.

This Mutex class provides a platform independant interface to the underlying mutex implementation (which is accessed through the MutexImpl class interface).

There is a single, global TSE3 Mutex object that is used by the entire library. This is accessed by calling the mutex static member function.

On each different platform supported by TSE3 there will be a specific MutexImpl class.

By default, the TSE3 library is not configured to be thread safe: the default MutexImpl that will be used is the NullMutexImpl. This implementation performs no operations for lock and unlock.

In order to make TSE3 thread safe, you must have an implementation of the MutexImpl class, and pass this to the static setImpl method BEFORE using any of the other TSE3 API. (In fact, you only need set this before the first call to the static mutex method, but most API functions will call this at some time).

A simplification of the Mutex API is provided by the CritSec class. In some cases this is a more convenient interface to use.

See also: MutexImpl, NullMutexImpl, CritSec

CritSec (class)

CritSec

A 'critical section' class that provides a somewhat more convenient interface to the Mutex class. A CritSec object simply locks the global Mutex upon creation and unlocks it on destruction.

Therefore, this means that rather than write:


     {
         TSE3::Impl::Mutex::mutex()->lock();
         // do something
         TSE3::Impl::Mutex::mutex()->unlock();
     }

You can simply write:


     {
         TSE3::Impl::CritSec cs;
         // do something
     }

Clearly, this prevents a possible source of error, where you might forget to unlock the mutex after having locked it. It is also in most cases a lot more convenient to use.

The CritSec class is small, simple and implemented with inline functions so the resultant generated code for both of the above examples is identical.

See also: Mutex

def_type (class)

def_type

This is a minimal default type. It is used by the Event class to represent 'no type specified'.

arg_count (struct)

arg_count

This class template is used as a compile time utility to count how many parameters have been passed to the Event class template. For most types its value is 1. The def_type is the only exception, its value is 0.

num_type (class)

num_type

A type used to overload member functions based on integer values. This is used in Event to figure out which Event::invokeImpl member function to call.

void_list (class)

void_list

A very simple "vector" class. It holds a list of void *s. It has enough vector-like methods that the Notifier framework can use it.

It is a disgusting thing to include in this library when we should just be using std::vector instead. In fact, this class is implemented with a std::vector. The reason for its inclusion is the fact that it redces the size of libtse3.so.0.0.0 by about a third. This can be accounted for by the reduction in size of link names.