On Tue, Apr 16, 2013 at 9:44 PM, Jeff King <p...@peff.net> wrote:
> On Tue, Apr 16, 2013 at 04:13:56PM +0200, Johannes Sixt wrote:
>> > I'm not clear on what you are suggesting. That we protect only the main
>> > thread from recursion, or that we drop the check entirely? Or that we
>> > implement thread-local storage for this case without using pthread_once?
>> Anything(*) that does not require pthread_once. A pthread_once
>> implementation on Windows would be tricky and voluminous and and on top of
>> it very likely to be done differently for gcc and MSVC. I don't like to go
>> there if we can avoid it.

This seems to have been settled as a "we don't need to go there"
already, but just in case; here's an implementation of
PTHREAD_MUTEX_INITIALIZER using double-checked locks, and it would
probably be repurposable to do pthread_once if needed:


Yes, it's not pretty, it's error-prone; the best thing would be not to do it.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to