Parallel and Multi-Core Computing with C/C++

Previous Next
0

This part will talk about enabling threadprivatization of static class member variables.

In 2.5, as a result of ambiguous language, the support for this was inconsistent. In general, it would claim that a threadprivate variable must be namespace, file or block scope.

In 3.0, this code is now allowed:

class T {
   public:
      static int i;
      #pragma omp threadprivate(i)
};


This may seem a trivial change, but for C++, it enables a powerful idiom of singletons and allocators, which all rely on static class member variable.

Next posting will continue with the semantics of private, first/lastprivate, threadprivate+copyin/copyprivate for C++.

Tags: openmp, c++


There are no comments on this post

Bottom Banner