aboutsummaryrefslogtreecommitdiff
path: root/libgomp/config/rtems/proc.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-09-03 11:34:28 +0000
committerSebastian Huber <sh@gcc.gnu.org>2015-09-03 11:34:28 +0000
commit06441dd5e3630dbeae13028968d0b12926211009 (patch)
tree052af5b0dae75a0d1bac729a2ab635e831bb7933 /libgomp/config/rtems/proc.c
parent66c59f92387c99ea5724cba69843f7dfb7593740 (diff)
downloadgcc-06441dd5e3630dbeae13028968d0b12926211009.zip
gcc-06441dd5e3630dbeae13028968d0b12926211009.tar.gz
gcc-06441dd5e3630dbeae13028968d0b12926211009.tar.bz2
[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. From-SVN: r227442
Diffstat (limited to 'libgomp/config/rtems/proc.c')
-rw-r--r--libgomp/config/rtems/proc.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/libgomp/config/rtems/proc.c b/libgomp/config/rtems/proc.c
index e879a9d..0c3a79b 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);
}
}
}