[Omp] one thread stop another thread

Ge, Steven steven.ge at intel.com
Sun Dec 12 18:31:48 PST 2004


I don't known how to implement your ideas by OpenMP.
But I think use a BOOL variable is OK in this case.
The BOOL variable is checked before execute each iteration. 
One thread reached the goal will set the BOOL variable so that another
thread will know it should exit.

There is another potential issue: the access of BOOL variable is atomic
or not?
It should depend on the architecture and will bring overhead.

Thanks
Steven

-----Original Message-----
From: Omp-bounces at openmp.org [mailto:Omp-bounces at openmp.org] On Behalf
Of andrew wang
Sent: Monday, December 13, 2004 10:11 AM
To: Omp at openmp.org
Subject: [Omp] one thread stop another thread

Hello,

I have a general issue regarding using OpenMP. I have put two loops in
two 
differrent threads. In one thread, once I reach my goal, I want to break

both threads. How could I do that in OpenMP?

I  notice "omp for" can not allow break inside, Is it a limitation?

Thanks in advance!
Andrew



_______________________________________________
Omp mailing list
Omp at openmp.org
http://openmp.org/mailman/listinfo/omp_openmp.org




More information about the Omp mailing list