next up previous
Next: First approach Up: Creating and managing threads Previous: Operating system dependence and

C interface to threads versus C++

While ACE encapsulates almost all of the synchronization and interprocess interface into C++ classes, it for some reason does not do so for thread creation. Rather it only offers the basic C interface: when creating a new thread, a function is called which has the following signature:

Code sample 1  
    void *  f (void * arg);

Thus, only functions which take a single parameter of type void* and return a void* may be called. Further, these functions must be global or static member functions, as opposed to true member functions of classes. This is not in line with the C++ philosophy and in fact does not fit well into deal.II as well: there is not a single function in the library that has this signature.

The task of multi-threading support in deal.II is therefore to encapsulate member functions, arbitrary types and numbers of parameters, and return types of functions into mechanisms built atop of ACE. This has been done twice for deal.II, and we will explain both approaches. At present, i.e. with version 3.0, only the first approach is distributed with deal.II, since the second is still experimental and due to the high complexity. The latter approach, however, has clear advantages over the first one, and it is planned to switch to it in the next major version of deal.II.


next up previous
Next: First approach Up: Creating and managing threads Previous: Operating system dependence and
Wolfgang Bangerth
2000-04-20