[Patch] C1X threading support
Daniel Eischen
deischen at freebsd.org
Tue Dec 20 17:19:55 UTC 2011
On Tue, 20 Dec 2011, John Baldwin wrote:
> On Tuesday, December 20, 2011 9:34:54 am Niall Douglas wrote:
>
>>>>> Why are fundamentally and necessary programming tools, such as a
>>>>> "assert this mutex is held" missing ?
>>>>
>>>> I think that was rejected due to concerns about introducing race
>>>> conditions if I remember correctly. You'll generally find there is no
>>>> easy way of checking the state of anything threading related for the
>>>> same reason.
>>>
>>> Err, no, there should be no races here.
>>
>> Sorry, I meant race conditions in the way a typical end user
>> programmer might naively choose to use it. A lot of APIs were dropped
>> or modified to help inhibit the damage from naïve use.
>
> Humm. I fail to see how a user can misuse an assert() in a way that creates
> a race condition. An assert(), by it's nature, should have no program visible
> changes. If the programmer puts the assertion in the wrong place then it
> may very well lead to false positives, but that is true of any assertion. I
> can understand why you may not want users to use the equivalent of an
> 'islocked' function (I'm not a big fan of those myself), but an assertion is
> weaker than an 'islocked' function.
>
> We could look at adding an _np extension. However, I expect that in practice
> nothing is going to use this API for a long while (if ever). On POSIX systems
> pthreads is going to be more portable and there is a lot of code already
> written to pthreads.
And that is exactly the point that Butenhof makes in this comment
about the ISO C standard 3 years ago:
https://www.opengroup.org/sophocles/show_mail.tpl?CALLER=show_archive.tpl&source=L&listname=austin-group-l&id=11671
His comments are a good read, and are still being echoed
in this thread.
I wonder how much the final standard changed from the working
standard to which his comments pertain...
--
DE
More information about the freebsd-threads
mailing list