This example demonstrates the use of parallel sections construct. The three functions, fun1, fun2, and fun3, all can be executed concurrently. Note that all the section directives need to appear in the parallel sections construct.
void fun1(); void fun2(); void fun3();
void parallel_sec()
{
#pragma omp parallel sections
{
#pragma omp section fun1();
#pragma omp section fun2();
#pragma omp section fun3();
}
}