I'm referring to this question: Parallel OpenMP loop with break statement
The code suggested here:
volatile bool flag=false;
#pragma omp parallel for shared(flag)
for(int i=0; i<=100000; ++i)
{
if(flag) continue;
if(element[i] ...)
{
...
flag=true;
}
}
What are the advantages of using continue
? Is it faster than doing the following:
volatile bool flag=false;
#pragma omp parallel for shared(flag)
for(int i=0; i<=100000; ++i)
{
if(!flag)
{
if(element[i] ...)
{
...
flag=true;
}
}
}