omp_in_parallel
Returns nonzero if called from within a parallel region.
int omp_in_parallel( );
Remarks
For more information, see 3.1.6 omp_in_parallel Function.
Example
// omp_in_parallel.cpp
// compile with: /openmp
#include <stdio.h>
#include <omp.h>
int main( )
{
omp_set_num_threads(4);
printf_s("%d\n", omp_in_parallel( ));
#pragma omp parallel
#pragma omp master
{
printf_s("%d\n", omp_in_parallel( ));
}
}
0 1