peter wrote:i will try to post little "pseudo"-code:
myclass * myvar = function(); // this function returns a pointer to a myclass-Object
...
int i;
int n = 1000;
int z = 2;
#pragma omp parallel for private(i) shared(myvar, n) firstprivate(z) default(shared)
for (i = 1; i <n; i++)
{
api_function(myvar); // its an api-function from the CAD-API ACIS which reads the myclass-variable
}
Info: if you now little about the CAD-API ACIS: i use a pointer to a BODY- and a FACE-object
it's sure that the api_function only reads the myclass-variable!!!
I assume there must be something more to this than what you are showing, because calling api_function to do the same thing "n" times doesn't really make any sense to me. In any case, if the api_function is only reading myvar, then this should work IF the api_function is "threadsafe". That is, it may be keeping global information that if accessed by multiple threads will cause a data race. You need to look at the documentation for the CAD-API and see what it says about this issue.
