Critical constructΒΆ
The critical
construct allows programmers to specify regions of code that will be executed in mutual exclusion.
The associated region will be executed by a single thread at a time, other threads will wait at the beginning of the critical section until no thread is executing it.
The syntax of the critical
construct is the following:
#pragma oss critical
structured-block
The syntax also allows named criticals with the following syntax:
#pragma oss critical(<name>)
structured-block
Named criticals prevent concurrency between threads with respect to all critical regions with the same name. Unnamed criticals prevent concurrency between threads with respect to all unnamed critical regions.
The critical construct has no related clauses. The beginning and ending of a critical section may be task scheduling points.