Revision: 152 http://trac.macosforge.org/projects/libdispatch/changeset/152 Author: robert@fledge.watson.org Date: 2009-11-13 06:18:10 -0800 (Fri, 13 Nov 2009) Log Message: ----------- If syscont() and _SC_NPROCESSORS_ONLN are available, use that as a fallback configuration option, which should permit Solaris to probe the number of CPUs. Obtained from: Joakim Johansson <jocke@tbricks.com> Modified Paths: -------------- trunk/src/queue.c Modified: trunk/src/queue.c =================================================================== --- trunk/src/queue.c 2009-11-13 14:17:32 UTC (rev 151) +++ trunk/src/queue.c 2009-11-13 14:18:10 UTC (rev 152) @@ -473,6 +473,13 @@ _dispatch_hw_config.cc_max_logical = _dispatch_hw_config.cc_max_physical = _dispatch_hw_config.cc_max_active; +#elif HAVE_SYSCONF && defined(_SC_NPROCESSORS_ONLN) + _dispatch_hw_config.cc_max_active = (int)sysconf(_SC_NPROCESSORS_ONLN); + if (_dispatch_hw_config.cc_max_active < 0) + _dispatch_hw_config.cc_max_active = 1; + _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 =
participants (1)
-
source_changes@macosforge.org