From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21659 invoked by alias); 28 May 2011 17:29:25 -0000 Received: (qmail 21647 invoked by uid 22791); 28 May 2011 17:29:24 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-pz0-f47.google.com (HELO mail-pz0-f47.google.com) (209.85.210.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 28 May 2011 17:29:10 +0000 Received: by pzk36 with SMTP id 36so1223302pzk.20 for ; Sat, 28 May 2011 10:29:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.247.25 with SMTP id u25mr462211wfh.362.1306603750085; Sat, 28 May 2011 10:29:10 -0700 (PDT) Received: by 10.142.69.21 with HTTP; Sat, 28 May 2011 10:29:10 -0700 (PDT) In-Reply-To: References: Date: Sun, 29 May 2011 09:04:00 -0000 Message-ID: Subject: Re: [v3] define std::thread::hardware_concurrency() From: Jonathan Wakely To: "libstdc++" , gcc-patches Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-05/txt/msg02251.txt.bz2 On 28 May 2011 01:43, Jonathan Wakely wrote: > This patch uses glibc's get_nprocs() or the non-standard but widely > available _SC_NPROCESSORS_ONLN sysconf variable to determine the > number of processors. > > 2011-05-28 =A0Jonathan Wakely =A0 > > =A0 =A0 =A0 =A0* acinclude.m4: Define GLIBCXX_CHECK_GET_NPROCS and > =A0 =A0 =A0 =A0GLIBCXX_CHECK_SC_NPROCESSORS_ONLN. > =A0 =A0 =A0 =A0* configure.ac: Use them. Increase minor version. > =A0 =A0 =A0 =A0* configure: Regenerate. > =A0 =A0 =A0 =A0* config.h.in: Regenerate. > =A0 =A0 =A0 =A0* include/std/thread (thread::hardware_concurrency): Remov= e inline > =A0 =A0 =A0 =A0definition. > =A0 =A0 =A0 =A0* src/thread.cc (thread::hardware_concurrency): Define. > =A0 =A0 =A0 =A0* config/abi/pre/gnu.ver: Export new symbol @3.4.17 > =A0 =A0 =A0 =A0* testsuite/util/testsuite_abi.cc: Add new version. > =A0 =A0 =A0 =A0* testsuite/lib/libstdc++.exp (check_v3_target_nprocs): Ad= d. > =A0 =A0 =A0 =A0* testsuite/lib/dg-options.exp (dg-require-nprocs): Add. > =A0 =A0 =A0 =A0* testsuite/30_threads/thread/members/hardware_concurrency= .cc: Use > =A0 =A0 =A0 =A0dg-require-nprocs and verify hardware_concurrency returns = non-zero. > > > Tested x86_64-linux, I intend to commit to trunk tomorrow. I've checked that patch in, so the library version on mainline is libstdc++.so.6.0.17 now. If my configury changes or using sysconf breaks anything I'll try to fix it asap.