[libdispatch-changes] [152] trunk/src/queue.c

source_changes at macosforge.org source_changes at macosforge.org
Fri Nov 13 06:18:11 PST 2009


Revision: 152
          http://trac.macosforge.org/projects/libdispatch/changeset/152
Author:   robert at 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 at 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 =
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-changes/attachments/20091113/71c334bc/attachment.html>


More information about the libdispatch-changes mailing list