[libdispatch-dev] Solaris portability, online CPU count detection - PATCH [3/6]
Robert Watson
robert at fledge.watson.org
Fri Nov 13 06:19:00 PST 2009
On Fri, 6 Nov 2009, Joakim Johansson wrote:
> Joakim
I've committed a configure.ac test for sysconf() as r151, and a variation on
the below as r152. For now, if the sysconf constant is defined and sysconf
fails, I just cap the number of CPUs to 1 as we do in the "I don't have way to
measure" case, rather than provide a runtime warning/error. Perhaps we should
do something more firm, such as erroring out.
Thanks,
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