diff options
author | sh <sh@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-09-03 11:34:28 +0000 |
---|---|---|
committer | sh <sh@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-09-03 11:34:28 +0000 |
commit | 6e7237399772a1439925a7b9e84217547c4b1c7c (patch) | |
tree | 052af5b0dae75a0d1bac729a2ab635e831bb7933 /libgomp/config/rtems/proc.c | |
parent | 65cb1e66fa23d3b05db674284aaffda1890f5688 (diff) | |
download | gcc-6e7237399772a1439925a7b9e84217547c4b1c7c.tar.gz |
[gomp] Add thread attribute customization
libgomp/ChangeLog
* config/posix/pool.h (gomp_adjust_thread_attr): New.
* config/rtems/pool.h (gomp_adjust_thread_attr): Likewise.
(gomp_thread_pool_reservoir): Add priority member.
* confi/rtems/proc.c (allocate_thread_pool_reservoir): Add
priority.
(parse_thread_pools): Likewise.
* team.c (gomp_team_start): Call configuration provided
gomp_adjust_thread_attr(). Destroy thread attributes if
necessary.
* libgomp.texi: Document GOMP_RTEMS_THREAD_POOLS.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227442 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/config/rtems/proc.c')
-rw-r--r-- | libgomp/config/rtems/proc.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/libgomp/config/rtems/proc.c b/libgomp/config/rtems/proc.c index e879a9d41bb..0c3a79bf2d8 100644 --- a/libgomp/config/rtems/proc.c +++ b/libgomp/config/rtems/proc.c @@ -48,7 +48,8 @@ allocate_thread_pool_reservoirs (void) } static void -allocate_thread_pool_reservoir (unsigned long count, unsigned long scheduler) +allocate_thread_pool_reservoir (unsigned long count, unsigned long priority, + unsigned long scheduler) { struct gomp_thread_pool_reservoir *res; struct gomp_thread_pool *pools; @@ -63,6 +64,7 @@ allocate_thread_pool_reservoir (unsigned long count, unsigned long scheduler) memset (pools, 0, size); res = (struct gomp_thread_pool_reservoir *) (pools + count); res->index = count; + res->priority = priority; gomp_sem_init (&res->available, count); gomp_mutex_init (&res->lock); for (i = 0; i < count; ++i) @@ -71,7 +73,8 @@ allocate_thread_pool_reservoir (unsigned long count, unsigned long scheduler) } static char * -parse_thread_pools (char *env, unsigned long *count, unsigned long *scheduler) +parse_thread_pools (char *env, unsigned long *count, unsigned long *priority, + unsigned long *scheduler) { size_t len; int i; @@ -84,6 +87,17 @@ parse_thread_pools (char *env, unsigned long *count, unsigned long *scheduler) if (errno != 0) gomp_fatal ("Invalid thread pool count"); + if (*env == '$') + { + ++env; + errno = 0; + *priority = strtoul (env, &env, 10); + if (errno != 0) + gomp_fatal ("Invalid thread pool priority"); + } + else + *priority = -1; + if (*env != '@') gomp_fatal ("Invalid thread pool scheduler prefix"); ++env; @@ -110,9 +124,10 @@ init_thread_pool_reservoirs (void) while (*env != '\0') { unsigned long count; + unsigned long priority; unsigned long scheduler; - env = parse_thread_pools (env, &count, &scheduler); - allocate_thread_pool_reservoir (count, scheduler); + env = parse_thread_pools (env, &count, &priority, &scheduler); + allocate_thread_pool_reservoir (count, priority, scheduler); } } } |