re PR libgomp/55411 (OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed)

PR libgomp/55411
	* team.c (gomp_free_thread): Decrease gomp_managed_threads
	if pool had any threads_used.

From-SVN: r193706
This commit is contained in:
Jakub Jelinek 2012-11-21 21:29:14 +01:00 committed by Jakub Jelinek
parent b4b401d23c
commit 4c5ba8d0db
2 changed files with 16 additions and 1 deletions

View File

@ -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

View File

@ -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)