[libdispatch-dev] Solaris portability, online CPU count detection - PATCH [3/6]
Robert Watson
robert at fledge.watson.org
Fri Nov 6 14:26:12 PST 2009
On Fri, 6 Nov 2009, Joakim Johansson wrote:
> Joakim
Unfortunately, the sysctl interface used to query this information on Mac OS X
and FreeBSD (and the similar procfs interface on Linux) doesn't lend itself to
compile-time feature checks. However, the sysconf/_SC_NPROCESSORS_ONLN
interface used on Solaris does, so perhaps we should be using a feature test
in configure.ac for that interface?
Kevin or others at Apple: might we hope to see a sysconf-based capability test
along similar lines appear in Mac OS X in the future? We could add a similar
one to FreeBSD as well without much trouble at all.
Robert
>
>> svn diff queue.c
> Index: queue.c
> ===================================================================
> --- queue.c (revision 140)
> +++ queue.c (working copy)
> @@ -473,6 +473,13 @@
> _dispatch_hw_config.cc_max_logical =
> _dispatch_hw_config.cc_max_physical =
> _dispatch_hw_config.cc_max_active;
> +#elif defined (__SVR4) && defined (__sun)
> + _dispatch_hw_config.cc_max_active = (int)
> sysconf(_SC_NPROCESSORS_ONLN);
> +
> + _dispatch_hw_config.cc_max_logical =
> + _dispatch_hw_config.cc_max_physical =
> + _dispatch_hw_config.cc_max_active;
> +
> #else
> #warning "_dispatch_queue_set_width_init: no supported way to query CPU
> count"
> _dispatch_hw_config.cc_max_logical =
>
> _______________________________________________
> libdispatch-dev mailing list
> libdispatch-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
More information about the libdispatch-dev
mailing list