summaryrefslogtreecommitdiff
path: root/libcilkrts
diff options
context:
space:
mode:
authorro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-04 10:13:55 +0000
committerro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-04 10:13:55 +0000
commit65948509b45b09e52fe2d18dca1e6539cb9766ab (patch)
tree6bc496ca21c66cb8d56d6db32e287636c29f2394 /libcilkrts
parent7b5733e8650fccfb19b6a45617a6c254a95569bd (diff)
downloadgcc-65948509b45b09e52fe2d18dca1e6539cb9766ab.tar.gz
* runtime/os-unix.c [__sun__ && __svr4__]: Include <sched.h>.
(__cilkrts_hardware_cpu_count) [__sun__ && __svr4__]: Use sysconf. (__cilkrts_yield) [__sun__ && __svr4__]: Use sched_yield. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204347 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcilkrts')
-rw-r--r--libcilkrts/ChangeLog6
-rw-r--r--libcilkrts/runtime/os-unix.c11
2 files changed, 13 insertions, 4 deletions
diff --git a/libcilkrts/ChangeLog b/libcilkrts/ChangeLog
index 77cc90c893e..a21f1429a71 100644
--- a/libcilkrts/ChangeLog
+++ b/libcilkrts/ChangeLog
@@ -1,3 +1,9 @@
+2013-11-04 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * runtime/os-unix.c [__sun__ && __svr4__]: Include <sched.h>.
+ (__cilkrts_hardware_cpu_count) [__sun__ && __svr4__]: Use sysconf.
+ (__cilkrts_yield) [__sun__ && __svr4__]: Use sched_yield.
+
2013-10-31 Balaji V. Iyer <balaji.v.iyer@intel.com>
PR other/58925
diff --git a/libcilkrts/runtime/os-unix.c b/libcilkrts/runtime/os-unix.c
index b48fd623c6e..dbca21f6f3c 100644
--- a/libcilkrts/runtime/os-unix.c
+++ b/libcilkrts/runtime/os-unix.c
@@ -62,6 +62,9 @@
# include <vxWorks.h>
# include <vxCpuLib.h>
# include <taskLib.h>
+// Solaris
+#elif defined __sun__ && defined __svr4__
+# include <sched.h>
#else
# error "Unsupported OS"
#endif
@@ -346,7 +349,7 @@ static int linux_get_affinity_count (int tid)
COMMON_SYSDEP int __cilkrts_hardware_cpu_count(void)
{
-#if defined ANDROID
+#if defined ANDROID || (defined(__sun__) && defined(__svr4__))
return sysconf (_SC_NPROCESSORS_ONLN);
#elif defined __MIC__
/// HACK: Usually, the 3rd and 4th hyperthreads are not beneficial
@@ -401,9 +404,9 @@ COMMON_SYSDEP void __cilkrts_yield(void)
// giving up the processor and latency starting up when work becomes
// available
_mm_delay_32(1024);
-#elif defined(ANDROID)
- // On Android, call sched_yield to yield quantum. I'm not sure why we
- // don't do this on Linux also.
+#elif defined(ANDROID) || (defined(__sun__) && defined(__svr4__))
+ // On Android and Solaris, call sched_yield to yield quantum. I'm not
+ // sure why we don't do this on Linux also.
sched_yield();
#else
// On Linux, call pthread_yield (which in turn will call sched_yield)