mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
28 lines
392 B
C
28 lines
392 B
C
/*
|
|
* @@name: worksharing_critical.1c
|
|
* @@type: C
|
|
* @@compilable: yes
|
|
* @@linkable: no
|
|
* @@expect: success
|
|
*/
|
|
void critical_work()
|
|
{
|
|
int i = 1;
|
|
#pragma omp parallel sections
|
|
{
|
|
#pragma omp section
|
|
{
|
|
#pragma omp critical (name)
|
|
{
|
|
#pragma omp parallel
|
|
{
|
|
#pragma omp single
|
|
{
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|