mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
31 lines
438 B
C
31 lines
438 B
C
/*
|
|
* @@name: single.1c
|
|
* @@type: C
|
|
* @@compilable: yes
|
|
* @@linkable: no
|
|
* @@expect: success
|
|
*/
|
|
#include <stdio.h>
|
|
|
|
void work1() {}
|
|
void work2() {}
|
|
|
|
void single_example()
|
|
{
|
|
#pragma omp parallel
|
|
{
|
|
#pragma omp single
|
|
printf("Beginning work1.\n");
|
|
|
|
work1();
|
|
|
|
#pragma omp single
|
|
printf("Finishing work1.\n");
|
|
|
|
#pragma omp single nowait
|
|
printf("Finished work1 and beginning work2.\n");
|
|
|
|
work2();
|
|
}
|
|
}
|