The taskwait construct, which is a stand-alone directive, specifies a wait on the completion of child tasks of the current task. Note: remember that even in a parallel region, each thread is executing an implicit task. Do not confuse the taskwait and taskgroup constructs, they may be similar but remain different. Indeed, the taskwait construct does not wait for the tasks that these child tasks could spawn, while the taskgroup does.
#pragma omp taskwait [depend([modifier,] type: list)]