Definition
The task clause creates an explicit task encapsulating the structured block assigned. It will either be executed immediately by the thread that encountered the task clause, either deferred and executed by any thread in the team. There are two ways to explicitly wait for the completion of tasks: barrier and taskwait.
#pragma omp task [if([task:] scalar-expression)]
[final(scalar-expression)]
[untied]
[default(policy)]
[mergeable]
[private(list)]
[firstprivate(list)]
[shared(list)]
[in_reduction([modifier,] identifier: list)]
[depend([modifier,] type: list)]
[priority(priority-value)]
[allocate([allocator:] list)]
[affinity([modifier:] list)]
[detach(event-handle)]