Intel® C++ Compiler 16.0 User and Reference Guide

omp taskyield

Specifies that the current task can be suspended at this point, in favor of execution of a different task.

Syntax

#pragma omp taskyield

Arguments

None

Description

Because the taskyield construct is a stand-alone pragma, there are some restrictions on its placement within a program:

The taskyield construct binds to the current task region. The binding thread set of the taskyield construct is the current team.

The taskyield construct includes an explicit task scheduling point in the current task region.

Example

#pragma omp task {	
     long_function();
     #pragma omp taskyield    // allow task to be suspended, if needed
     long_function2();
}