From owner-freebsd-threads@FreeBSD.ORG Thu Dec 22 17:06:58 2011 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22C8C106564A for ; Thu, 22 Dec 2011 17:06:58 +0000 (UTC) (envelope-from martin@lispworks.com) Received: from lwfs1-cam.cam.lispworks.com (mail.lispworks.com [193.34.186.230]) by mx1.freebsd.org (Postfix) with ESMTP id ACAA88FC18 for ; Thu, 22 Dec 2011 17:06:57 +0000 (UTC) Received: from higson.cam.lispworks.com (higson [192.168.1.7]) by lwfs1-cam.cam.lispworks.com (8.14.3/8.14.3) with ESMTP id pBMGuWvA064762; Thu, 22 Dec 2011 16:56:32 GMT (envelope-from martin@lispworks.com) Received: from higson.cam.lispworks.com (localhost.localdomain [127.0.0.1]) by higson.cam.lispworks.com (8.14.4) id pBMGuW2n009251; Thu, 22 Dec 2011 16:56:32 GMT Received: (from martin@localhost) by higson.cam.lispworks.com (8.14.4/8.14.4/Submit) id pBMGuWHT009247; Thu, 22 Dec 2011 16:56:32 GMT Date: Thu, 22 Dec 2011 16:56:32 GMT Message-Id: <201112221656.pBMGuWHT009247@higson.cam.lispworks.com> From: Martin Simmons To: freebsd-threads@freebsd.org In-reply-to: <4EF0DF50.9243.B766CF98@s_sourceforge.nedprod.com> References: , <4EF09D0E.14095.B663FD3C@s_sourceforge.nedprod.com>, <201112201009.25534.jhb@freebsd.org> <4EF0DF50.9243.B766CF98@s_sourceforge.nedprod.com> 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: Thu, 22 Dec 2011 17:06:58 -0000 >>>>> On Tue, 20 Dec 2011 19:17:36 -0000, Niall Douglas said: > > My statements come from my (prolonged) efforts to develop a safe > permit threading object for C11 as people have the tendency to roll > their own buggy implementations which just don't work right. This was > based on the Java permit primitive, but because C has function > pointers it is more flexible. You can see the last public version of > this at https://github.com/ned14/C1Xstuff/tree/ISO_TS_pre/N1572. BTW, > it needs splitting into two implementations, one for single releaser > and the other for multi releaser. > > During the very drawn out process of consulting with everyone who has > a stake in this, I probably talked to almost everyone who contributed > to the threading libraries of C (and indeed C++). The fact they > repeatedly beat my design and implementation into pieces was > immensely frustrating but in hindsight they were right. As much as > it's design by committee, there is one hell of a lot of talent in > that pool. Feel free to take this off the freebsd-threads mailing list if you think it is too off topic, but I can't find a reference to any Java primitive called a permit. NB: in general, the safest way to use pthread_cond_signal (and presumably cnd_signal) is while holding the mutex that you passed to pthread_cond_wait. If you don't do that, then you run the risk of losing the signal and having to do crazy loops like in your permit code. __Martin