I think you can do this with the OpenMP section directive, which you can do with ICC, GCC and MSVC. The OpenMP task directive is probably the best choice and can be done with ICC and GCC, but not with any version of MSVC.
The code below uses OpenMP sections . Since E starts after all other tasks are completed, it can also be parallelized, so in the following E code, all threads are executed after A, B, C, D . If E iterates over a loop, you can parallelize the loop this way. I'm not sure what you want, but it's easy to get it working on a single thread, as if you wanted to.
#include <stdio.h>
user2088790
source share