Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Dec 2011 16:56:32 GMT
From:      Martin Simmons <martin@lispworks.com>
To:        freebsd-threads@freebsd.org
Subject:   Re: [Patch] C1X threading support
Message-ID:  <201112221656.pBMGuWHT009247@higson.cam.lispworks.com>
In-Reply-To: <4EF0DF50.9243.B766CF98@s_sourceforge.nedprod.com>
References:  <Your message of <4EF059DC.26433.B55D8036@s_sourceforge.nedprod.com>, <4EF09D0E.14095.B663FD3C@s_sourceforge.nedprod.com>, <201112201009.25534.jhb@freebsd.org> <4EF0DF50.9243.B766CF98@s_sourceforge.nedprod.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112221656.pBMGuWHT009247>