OS Threading Abstraction (and Independence) Layer

Wefts++ is a multi-platform multi threading 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.

More description

Generated on Tue Oct 5 14:57:01 2004 for Wefts by doxygen 1.3.7