summaryrefslogtreecommitdiff
path: root/libgomp/team.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-09-03 11:29:59 +0000
committerSebastian Huber <sh@gcc.gnu.org>2015-09-03 11:29:59 +0000
commit66c59f92387c99ea5724cba69843f7dfb7593740 (patch)
tree28616f3c911c89d9490c31eed99f4fed03829f54 /libgomp/team.c
parent13c41b2e3e0cf6996ea2d49e0557814607fe2f59 (diff)
downloadgcc-66c59f92387c99ea5724cba69843f7dfb7593740.tar.gz
[gomp] Thread pool management
libgomp/ChangeLog * config/posix/pool.h: New. * config/rtems/pool.h: Likewise. * config/rtems/proc.c: Likewise. * libgomp.h (gomp_thread_destructor): Declare. * team.c: Include configuration provided "pool.h". (gomp_get_thread_pool): Define in configuration. (gomp_team_end): Call configuration defined gomp_release_thread_pool(). From-SVN: r227441
Diffstat (limited to 'libgomp/team.c')
-rw-r--r--libgomp/team.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/libgomp/team.c b/libgomp/team.c
index e1c4d60270e..274f3ed8a66 100644
--- a/libgomp/team.c
+++ b/libgomp/team.c
@@ -27,6 +27,7 @@
creation and termination. */
#include "libgomp.h"
+#include "pool.h"
#include <stdlib.h>
#include <string.h>
@@ -134,26 +135,6 @@ gomp_thread_start (void *xdata)
return NULL;
}
-/* Get the thread pool, allocate and initialize it on demand. */
-
-static inline struct gomp_thread_pool *
-gomp_get_thread_pool (struct gomp_thread *thr, unsigned nthreads)
-{
- struct gomp_thread_pool *pool = thr->thread_pool;
- if (__builtin_expect (pool == NULL, 0))
- {
- pool = gomp_malloc (sizeof (*pool));
- pool->threads = NULL;
- pool->threads_size = 0;
- pool->threads_used = 0;
- pool->last_team = NULL;
- pool->threads_busy = nthreads;
- thr->thread_pool = pool;
- pthread_setspecific (gomp_thread_destructor, thr);
- }
- return pool;
-}
-
static inline struct gomp_team *
get_last_team (unsigned nthreads)
{
@@ -930,6 +911,7 @@ gomp_team_end (void)
if (pool->last_team)
free_team (pool->last_team);
pool->last_team = team;
+ gomp_release_thread_pool (pool);
}
}