OpenMP: how to clear a pointer?

Ive just noticed that the following code does not compile in OpenMP (in GCC 4.5.1):

struct job {
    unsigned busy_children;
};

job* j = allocateJob(…);
// …

#pragma omp flush(j->busy_children)

The compiler complains about ->the argument list in order to clear it, and according to the OpenMP specification it is right: it flushexpects "id-expression" s as arguments of the list, which basically means only (qualified) Identifiers are allowed, there are no expressions.

In addition, the specification talks about flushpointers:

If the pointer is in the list, the pointer itself is purged, not the memory block referenced by the pointer.

Of course. However, since OpenMP also does not allow me to play pointers, I basically cannot clear the pointee (pointer).

- ? , , .

unsigned& busy_children = j->busy_children;
#pragma omp flush(busy_children)

?

, , pointee?

+3
2

flush OpenMP ARB . , - . () , OpenMP . , , , . , ().

, , ( ). , , . " ", , .

+2

OpenMP , MSDN , ", flush, ". , . flush , .

+1

Source: https://habr.com/ru/post/1788321/


All Articles