aboutsummaryrefslogtreecommitdiff
path: root/libgomp/config
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-12-02 14:10:33 +0000
committerSebastian Huber <sh@gcc.gnu.org>2016-12-02 14:10:33 +0000
commitd313d52cd5fff9374f01967fb7964b6633df219c (patch)
tree653fcd1f097ac796d49bea19a3fca4d48bf32f50 /libgomp/config
parent310a7f96996f46f1565376f092e08daa1d44d1e7 (diff)
downloadgcc-d313d52cd5fff9374f01967fb7964b6633df219c.zip
gcc-d313d52cd5fff9374f01967fb7964b6633df219c.tar.gz
gcc-d313d52cd5fff9374f01967fb7964b6633df219c.tar.bz2
[RTEMS] Fix libgomp for nthreads == 1
libgomp/ * config/rtems/pool.h (gomp_get_thread_pool): Return proper thread pool in case nthreads == 1. From-SVN: r243179
Diffstat (limited to 'libgomp/config')
-rw-r--r--libgomp/config/rtems/pool.h26
1 files changed, 11 insertions, 15 deletions
diff --git a/libgomp/config/rtems/pool.h b/libgomp/config/rtems/pool.h
index 7520c07..e69eca4 100644
--- a/libgomp/config/rtems/pool.h
+++ b/libgomp/config/rtems/pool.h
@@ -87,28 +87,24 @@ static inline struct gomp_thread_pool *
gomp_get_thread_pool (struct gomp_thread *thr, unsigned nthreads)
{
struct gomp_thread_pool *pool;
+ struct gomp_thread_pool_reservoir *res;
if (__builtin_expect (thr->thread_pool == NULL, 0))
pthread_setspecific (gomp_thread_destructor, thr);
- if (nthreads != 1)
+ res = gomp_get_thread_pool_reservoir ();
+ if (res != NULL)
{
- struct gomp_thread_pool_reservoir *res =
- gomp_get_thread_pool_reservoir ();
- if (res != NULL)
- {
- gomp_sem_wait (&res->available);
- gomp_mutex_lock (&res->lock);
- pool = res->pools[--res->index];
- gomp_mutex_unlock (&res->lock);
- pool->threads_busy = nthreads;
- thr->thread_pool = pool;
- }
- else
- pool = gomp_get_own_thread_pool (thr, nthreads);
+ gomp_sem_wait (&res->available);
+ gomp_mutex_lock (&res->lock);
+ pool = res->pools[--res->index];
+ gomp_mutex_unlock (&res->lock);
+ pool->threads_busy = nthreads;
+ thr->thread_pool = pool;
}
else
- pool = NULL;
+ pool = gomp_get_own_thread_pool (thr, nthreads);
+
return pool;
}