开发者

How not to wait for other threads in OpenMP?

I am considering using OpenMP for multithreading in C++. But I wonder if there is a way tell a thread not to wait for other concurrent thread and continue with my program? (Maybe I can cancel/kill other threads?)

I am aware of the existence of "nowait" clause, but I want the decision of "wait" or "not to wait" to be done dynamically (The program will decide depending on results of the process I am doi开发者_JAVA百科ng).

I hope I can get some advices on this.

Thanks in advance.


I'd would do it something along the lines of

if(conditon)
{
     taskA_with_Barriers();
}  
else
{
     taskA_without_Barrier();
}

The condtion needs to be the same constant through out all threads.

If you need to be canceling Threads you might be using the wrong technolgy. Might also want to take a look at pthreads or MPI.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜