|
Threads-Devel : |
From: Anthony Williams (anthony_at_[hidden])
Date: 2006-03-06 14:58:40
David Abrahams <dave_at_[hidden]> writes:
> Anthony Williams <anthony_at_[hidden]> writes:
>
>> You're probably right. I started down this line of thought when
>> rewriting boost::call_once, and noticed that mutexes at global scope
>> are used everywhere, and yet they are not thread-safe for
>> initialization. Maybe I could do with some perspective.
>>
>
> call_once relies on mutexes at global scope? I suppose these are
> platform mutexes, rather than boost mutexes, then?
I meant that call_once needs to work with static initialization at global
scope. Incidentally, the win32 implementation relies on a mutex to resolve
any race conditions that arise during initialization, but that's an
implementation detail.
Implementing call_once exposed me to the issues around static initialization,
which made me think about it for mutexes.
Anthony
-- Anthony Williams Software Developer Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk