[Patch] C1X threading support

Martin Simmons martin at lispworks.com
Thu Dec 22 17:06:58 UTC 2011


>>>>> 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


More information about the freebsd-threads mailing list