From owner-freebsd-threads@FreeBSD.ORG Fri Dec 16 22:42:46 2011 Return-Path: Delivered-To: threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2E641065670 for ; Fri, 16 Dec 2011 22:42:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 13CE08FC08 for ; Fri, 16 Dec 2011 22:42:45 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pBGM9F3W054901 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 17 Dec 2011 00:09:15 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pBGM9FOB054834; Sat, 17 Dec 2011 00:09:15 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pBGM9EbT054833; Sat, 17 Dec 2011 00:09:14 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 17 Dec 2011 00:09:14 +0200 From: Kostik Belousov To: Ed Schouten Message-ID: <20111216220914.GW50300@deviant.kiev.zoral.com.ua> References: <20111216214913.GA1771@hoeg.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ubsQ1kiTK0VEt5fK" Content-Disposition: inline In-Reply-To: <20111216214913.GA1771@hoeg.nl> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: threads@freebsd.org, arch@freebsd.org Subject: Re: [Patch] C1X threading support X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Dec 2011 22:42:46 -0000 --ubsQ1kiTK0VEt5fK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 16, 2011 at 10:49:13PM +0100, Ed Schouten wrote: > Hi folks, >=20 > We can expect C11 (or C12) to be released in the nearby future. I > already took the liberty of adding fallbacks for some of the language > keywords to , but it seems the standard also includes a new > threading API. >=20 > In my opinion the ISO folks suffer a bit from the Not Invented Here > syndrome. In an earlier revision of the C1X specification, they even > described a `struct xtime', which had a purpose identical to `struct > timespec'. The same holds for the threading API. It can be 1:1 mapped to > a subset of pthread -- why not simply standardize that subset then? >=20 > Putting my personal objections aside, I do think we should add support > for the API by the time C1X is final. Attached is a patch that adds the > new API to libthr. It simply wraps all the calls around pthread. Even > the objects used by the API are type compatible with the ones used by > pthread. >=20 > The questions: >=20 > - As this API is just a second-class citizen and will not be used by the > C library, I suspect there is no need for underscore prefixing and > weak aliasing. Is this correct? If application that does not use the new interface supposed to be able to implement function with new names, then the not-underscored symbols must be weak. >=20 > - When accompanied with man pages, are there any objections if I commit > this to SVN when C1X is official? +int +cnd_init(cnd_t *cond) +{ + + if (_pthread_cond_init(cond, NULL) !=3D 0) + return (errno =3D=3D ENOMEM ? thrd_nomem : thrd_error); + return (thrd_success); +} pthread_cond_init does not set errno, it returns error. There are several more instances of such errno use in the patch. Do you have reference to the draft ? --ubsQ1kiTK0VEt5fK Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7rwYoACgkQC3+MBN1Mb4gs5wCgzHFzXHOpcpSYL8VL9n9Zm2nz V7oAnjAWXKFwKlFwG6T3hXn6TF6qTMBh =llEm -----END PGP SIGNATURE----- --ubsQ1kiTK0VEt5fK--