Commit 2546da0b by Rainer Orth Committed by Rainer Orth

os-unix.c: Include <sched.h>.

	* runtime/os-unix.c [__sun__ && __svr4__]: Include <sched.h>.
	(__cilkrts_hardware_cpu_count) [__sun__ && __svr4__]: Use sysconf.
	(__cilkrts_yield) [__sun__ && __svr4__]: Use sched_yield.

From-SVN: r204347
parent 7405bd18
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> 2013-10-31 Balaji V. Iyer <balaji.v.iyer@intel.com>
PR other/58925 PR other/58925
......
...@@ -62,6 +62,9 @@ ...@@ -62,6 +62,9 @@
# include <vxWorks.h> # include <vxWorks.h>
# include <vxCpuLib.h> # include <vxCpuLib.h>
# include <taskLib.h> # include <taskLib.h>
// Solaris
#elif defined __sun__ && defined __svr4__
# include <sched.h>
#else #else
# error "Unsupported OS" # error "Unsupported OS"
#endif #endif
...@@ -346,7 +349,7 @@ static int linux_get_affinity_count (int tid) ...@@ -346,7 +349,7 @@ static int linux_get_affinity_count (int tid)
COMMON_SYSDEP int __cilkrts_hardware_cpu_count(void) COMMON_SYSDEP int __cilkrts_hardware_cpu_count(void)
{ {
#if defined ANDROID #if defined ANDROID || (defined(__sun__) && defined(__svr4__))
return sysconf (_SC_NPROCESSORS_ONLN); return sysconf (_SC_NPROCESSORS_ONLN);
#elif defined __MIC__ #elif defined __MIC__
/// HACK: Usually, the 3rd and 4th hyperthreads are not beneficial /// HACK: Usually, the 3rd and 4th hyperthreads are not beneficial
...@@ -401,9 +404,9 @@ COMMON_SYSDEP void __cilkrts_yield(void) ...@@ -401,9 +404,9 @@ COMMON_SYSDEP void __cilkrts_yield(void)
// giving up the processor and latency starting up when work becomes // giving up the processor and latency starting up when work becomes
// available // available
_mm_delay_32(1024); _mm_delay_32(1024);
#elif defined(ANDROID) #elif defined(ANDROID) || (defined(__sun__) && defined(__svr4__))
// On Android, call sched_yield to yield quantum. I'm not sure why we // On Android and Solaris, call sched_yield to yield quantum. I'm not
// don't do this on Linux also. // sure why we don't do this on Linux also.
sched_yield(); sched_yield();
#else #else
// On Linux, call pthread_yield (which in turn will call sched_yield) // On Linux, call pthread_yield (which in turn will call sched_yield)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment