아니요, 예외가있는 중요한 섹션을 나가는 것이 좋지 않습니다. g++
은이 경우에 불평하지 않지만 암시 적으로 임계 섹션의 블록 주위에 암시적인 try/catch
을 삽입합니다. 예를 들어 다음 코드를
:
#pragma omp critical (my_crit)
__builtin_GOMP_critical_name_start (&.gomp_critical_user_my_crit);
try
{
D.20639 = __cxa_allocate_exception (4);
try
{
MEM[(int *)D.20639] = 3;
}
catch
{
__cxa_free_exception (D.20639);
}
__cxa_throw (D.20639, &_ZTIi, 0B);
}
catch
{
<<<eh_must_not_throw (terminate)>>>
}
__builtin_GOMP_critical_name_end (&.gomp_critical_user_my_crit);
이 암시 내장 포괄 핸들러에게 매우 비정상적 종료에 <<<eh_must_not_throw (terminate)>>>
결과에 도달 :
#pragma omp critical (my_crit)
{
throw 3;
}
이로 GCC 4.7의 OpenMP를 프로세서에 의해 하향 조정됩니다
terminate called after throwing an instance of 'int'
Abort trap: 6
내재적 인 try/catch
은 외부 try/catch
구조의 존재에 관계없이 삽입됩니다. 즉, ex 언제든지 절은 critical
섹션을 떠나지 않을 것입니다.
OpenMP의 표준 위임 예외 대부분의 OpenMP 구조 (parallel
, section
, master
, single
, for
, critical
, task
등) 내에서 발생하는 경우, 실행은 동일한 구조 내에서 동일한 스레드 것을 재개해야 예외를 잡아야합니다. 이 제한 사항을 위반하면 OpenMP 코드가 적합하지 않으며 g++
은 모든 구조체에 종료 핸들러가있는 try/catch
블록을 삽입하여 적합성을 적용하기 만하면됩니다. 또한
For C/C++, an executable statement, possibly compound, with a single entry at the top and a single exit at the bottom, or an OpenMP construct.
과 (모든 언어) : 분명히
The point of exit cannot be a branch out of the structured block.
return
return
문이 존재하는 오류에 대해서는
는 OpenMP는 C/C++의 strcutured 블록을 정의 단순히 블록의 바닥이 떨어지는 것과는 달리, 블록의 분기를 구성한다.