aboutsummaryrefslogtreecommitdiff
path: root/libgomp/ordered.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-11-30 14:32:53 +1030
committerAlan Modra <amodra@gcc.gnu.org>2011-11-30 14:32:53 +1030
commitb40c885f183cb7d0b0970494220370699f93c2ae (patch)
treef2b455abcdef142ecdfee68c7c0c647af19edcdd /libgomp/ordered.c
parent3e348fccfa971cf81fe9fcf3489bf011979957e3 (diff)
downloadgcc-b40c885f183cb7d0b0970494220370699f93c2ae.zip
gcc-b40c885f183cb7d0b0970494220370699f93c2ae.tar.gz
gcc-b40c885f183cb7d0b0970494220370699f93c2ae.tar.bz2
ordered.c (gomp_ordered_sync): Add MEMMODEL_ACQ_REL fence.
* ordered.c (gomp_ordered_sync): Add MEMMODEL_ACQ_REL fence. * critical.c (GOMP_critical_start): Add MEMMODEL_RELEASE fence. * config/linux/mutex.h: Use atomic rather than sync builtins. * config/linux/mutex.c: Likewise. Comment. Use -1 for waiting state. * config/linux/omp-lock.h: Comment fix. * config/linux/arm/mutex.h: Delete. * config/linux/powerpc/mutex.h: Delete. * config/linux/ia64/mutex.h: Delete. * config/linux/mips/mutex.h: Delete. From-SVN: r181832
Diffstat (limited to 'libgomp/ordered.c')
-rw-r--r--libgomp/ordered.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libgomp/ordered.c b/libgomp/ordered.c
index e5673fe..f84d52e 100644
--- a/libgomp/ordered.c
+++ b/libgomp/ordered.c
@@ -207,8 +207,13 @@ gomp_ordered_sync (void)
post to our release semaphore. So the two cases are that we will
either win the race an momentarily block on the semaphore, or lose
the race and find the semaphore already unlocked and so not block.
- Either way we get correct results. */
+ Either way we get correct results.
+ However, there is an implicit flush on entry to an ordered region,
+ so we do need to have a barrier here. If we were taking a lock
+ this could be MEMMODEL_RELEASE since the acquire would be coverd
+ by the lock. */
+ __atomic_thread_fence (MEMMODEL_ACQ_REL);
if (ws->ordered_owner != thr->ts.team_id)
{
gomp_sem_wait (team->ordered_release[thr->ts.team_id]);