summaryrefslogtreecommitdiffstats
path: root/libgomp
diff options
context:
space:
mode:
authoramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>2013-02-01 12:52:41 +0000
committeramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>2013-02-01 12:52:41 +0000
commit2d46e4b92f3d123d34726827bef8354b68b4d76c (patch)
treee3c309016d5ae2d12e311b052c30ce5eb676d54c /libgomp
parentc74cfdafe60176a391169bf8222bb8098e486068 (diff)
downloadppe42-gcc-2d46e4b92f3d123d34726827bef8354b68b4d76c.tar.gz
ppe42-gcc-2d46e4b92f3d123d34726827bef8354b68b4d76c.zip
* task.c (GOMP_task, GOMP_taskwait): Comment.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195647 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog4
-rw-r--r--libgomp/task.c15
2 files changed, 19 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index d765f8a25ae..2bbb789c1a4 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,7 @@
+2013-02-01 Alan Modra <amodra@gmail.com>
+
+ * task.c (GOMP_task, GOMP_taskwait): Comment.
+
2013-01-31 Dmitry Vyukov <dvyukov@gcc.gnu.org>
Joost VandeVondele <Joost.VandeVondele@mat.ethz.ch>
diff --git a/libgomp/task.c b/libgomp/task.c
index 937f266cef3..7de650a43f1 100644
--- a/libgomp/task.c
+++ b/libgomp/task.c
@@ -116,6 +116,15 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
}
else
fn (data);
+ /* Access to "children" is normally done inside a task_lock
+ mutex region, but the only way this particular task.children
+ can be set is if this thread's task work function (fn)
+ creates children. So since the setter is *this* thread, we
+ need no barriers here when testing for non-NULL. We can have
+ task.children set by the current thread then changed by a
+ child thread, but seeing a stale non-NULL value is not a
+ problem. Once past the task_lock acquisition, this thread
+ will see the real value of task.children. */
if (task.children != NULL)
{
gomp_mutex_lock (&team->task_lock);
@@ -296,6 +305,12 @@ GOMP_taskwait (void)
struct gomp_task *child_task = NULL;
struct gomp_task *to_free = NULL;
+ /* The acquire barrier on load of task->children here synchronizes
+ with the write of a NULL in gomp_barrier_handle_tasks. It is
+ not necessary that we synchronize with other non-NULL writes at
+ this point, but we must ensure that all writes to memory by a
+ child thread task work function are seen before we exit from
+ GOMP_taskwait. */
if (task == NULL
|| __atomic_load_n (&task->children, MEMMODEL_ACQUIRE) == NULL)
return;
OpenPOWER on IntegriCloud