[c++0x] mutex and condition variable initializers

Jonathan Wakely jwakely.gcc@gmail.com
Thu May 14 19:24:00 GMT 2009


2009/5/13 Benjamin Kosnik:
>
>> Would it be worth adding a configure check to see if that works with
>> the chosen threading model and using it when possible?
>
> Well, since the actual code is conditional on
> _GTHREAD_MUTEX_INIT/_GTHREAD_COND_INIT, and you are only dealing with
> half of it, how are you planning on dealing with the other part of the
> condition? ie, _GTHREAD_MUTEX_INIT_FUNCTION? Don't see how this would
> end up being a win.

Yes, you've spotted the flaw  :-)
It would probably end up with three cases, the new initializer form
for posix-like gthr laters, the current assignment from temporary form
for e.g. gthr-single.h where the INIT macros expand to 0, and the
function call for when there's no INIT macro.

Probably not worth changing, since it only appears in two places.  Oh well.

Jonathan



More information about the Libstdc++ mailing list