Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OS Threading Abstraction (and Independence) Layer

Wefts++ is a multiplatform multi theading library. Although some concepts are mutated from pthread (both to simplify pthread-based Wefts implementation and because pthread model is the cleanest and more robust among the ones I know), this means that is necessary to give an abstraction layer so that is possible to link the different low-level threading libraries (or direct OS calls) that are available on the different systems.

For this reason, a restricted set of classes are written mainly using inline method to provide access to the low level api. The "wefts_os.h" file tests the environment to select a proper header file including OSThread, OSCondition, OSMutex and OSSpecificData, and sets proper defines to link the correct .cpp module that is sometimes required with os specific implementation. In example, the OS wrapper classes for pthreads are in wefts_os_pthread.cpp and wefts_os_pthread.h.

Wrappers are required to include the wefts_os_base.h, that contains the named classes with the suffix "Base" (i.e. OSThreadBase), that are abstract base classes that defines both a template and a standard for OS Layer implementation.

OS Implementations should follow a certain naming convention: they should define the classes using a meaningful suffix (i.e. for pthread OS Layer, OSThreadPthread). At the end of the header file, the classes should then be aliased using typedefs. In example, these are the last lines of wefts_os_pthread.h:

   typedef OSSPecificDataPthread OSSpecificData;
   typedef OSThreadPthread OSThread;
   typedef OSConditionPthread OSCondition;
   typedef OSMutexPthread OSMutex;

This will allow to have specific documentation for each implementation, and also to address directly a specific implementation routine, if necessary.

Todo:
More description


Generated on Mon Dec 22 04:12:36 2003 for Wefts by doxygen1.2.18