diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-04 15:44:20 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-04 15:44:20 +0000 |
commit | 8f697de691faf4ff96d6bef3c26760a3d8436404 (patch) | |
tree | ac821b38fafbfdcd8c9ded3ac49ca98b9174d998 /libgomp/configure.ac | |
parent | f5b1f90b7b0020267c34487a1ab6da238c3712b3 (diff) | |
download | gcc-8f697de691faf4ff96d6bef3c26760a3d8436404.tar.gz |
* libgomp.h (gomp_cpu_affinity, gomp_cpu_affinity_len): New extern
decls.
(gomp_init_affinity, gomp_init_thread_affinity): New prototypes.
* env.c (gomp_cpu_affinity, gomp_cpu_affinity_len): New variables.
(parse_affinity): New function.
(initialize_env): Call it and gomp_init_affinity.
* team.c (gomp_team_start): If gomp_cpu_affinity != NULL,
create new pthread_attr_t and call gomp_init_thread_affinity
on it for each thread before passing the attribute to pthread_create.
* config/linux/affinity.c: New file.
* config/posix/affinity.c: New file.
* configure.ac (HAVE_PTHREAD_AFFINITY_NP): New test.
* configure: Rebuilt.
* config.h.in: Rebuilt.
* Makefile.am (libgomp_la_SOURCES): Add affinity.c.
* Makefile.in: Rebuilt.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123494 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/configure.ac')
-rw-r--r-- | libgomp/configure.ac | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libgomp/configure.ac b/libgomp/configure.ac index 4ee96e2b3dd..427c8f7c753 100644 --- a/libgomp/configure.ac +++ b/libgomp/configure.ac @@ -236,6 +236,25 @@ If so, please configure with --disable-linux-futex]) ;; esac +# Check for pthread_{,attr_}[sg]etaffinity_np. +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [#define _GNU_SOURCE + #include <pthread.h>], + [cpu_set_t cpuset; + pthread_attr_t attr; + pthread_getaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset); + if (CPU_ISSET (0, &cpuset)) + CPU_SET (1, &cpuset); + else + CPU_ZERO (&cpuset); + pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset); + pthread_attr_init (&attr); + pthread_attr_getaffinity_np (&attr, sizeof (cpu_set_t), &cpuset); + pthread_attr_setaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);])], + AC_DEFINE(HAVE_PTHREAD_AFFINITY_NP, 1, +[ Define if pthread_{,attr_}{g,s}etaffinity_np is supported.])) + # At least for glibc, clock_gettime is in librt. But don't pull that # in if it still doesn't give us the function we want. if test $ac_cv_func_clock_gettime = no; then |