summaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-21 20:29:14 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-21 20:29:14 +0000
commit926ffdda8bb4574bcc4cf1412acee7e33f1ecfc8 (patch)
tree887d040b2c5718a47cc686597241eadd3156c25e /libgomp
parent5fa6d70f7377323565643fe8af74ab59e4c2e80e (diff)
downloadgcc-926ffdda8bb4574bcc4cf1412acee7e33f1ecfc8.tar.gz
PR libgomp/55411
* team.c (gomp_free_thread): Decrease gomp_managed_threads if pool had any threads_used. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193706 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog6
-rw-r--r--libgomp/team.c11
2 files changed, 16 insertions, 1 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index c114a2e23c5..ceebbfad17c 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,9 @@
+2012-11-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR libgomp/55411
+ * team.c (gomp_free_thread): Decrease gomp_managed_threads
+ if pool had any threads_used.
+
2012-11-07 Jack Howarth <howarth@bromo.med.uc.edu>
* testsuite/libgomp.c++/pr24455.C: Use
diff --git a/libgomp/team.c b/libgomp/team.c
index 633902ca567..110bd47116b 100644
--- a/libgomp/team.c
+++ b/libgomp/team.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006, 2007, 2008, 2009, 2011
+/* Copyright (C) 2005, 2006, 2007, 2008, 2009, 2011, 2012
Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
@@ -232,6 +232,15 @@ gomp_free_thread (void *arg __attribute__((unused)))
gomp_barrier_wait (&pool->threads_dock);
/* Now it is safe to destroy the barrier and free the pool. */
gomp_barrier_destroy (&pool->threads_dock);
+
+#ifdef HAVE_SYNC_BUILTINS
+ __sync_fetch_and_add (&gomp_managed_threads,
+ 1L - pool->threads_used);
+#else
+ gomp_mutex_lock (&gomp_remaining_threads_lock);
+ gomp_managed_threads -= pool->threads_used - 1L;
+ gomp_mutex_unlock (&gomp_remaining_threads_lock);
+#endif
}
free (pool->threads);
if (pool->last_team)