Boost logo

Boost :

Subject: Re: [boost] [locale] review part 2.2: source
From: Ilya Sokolov (ilyasokol_at_[hidden])
Date: 2011-04-18 03:26:08

On Fri, 15 Apr 2011 20:04:31 +0600, Artyom <artyomtnk_at_[hidden]> wrote:
> Steven Watanabe wrote:
>> win32/lcid.cpp:
>> line 89: I thought double checked locking was
>> considered unsafe?
> Not really
> I had a discussion with a professor an expert in
> this area, no problems when mutexes are full
> memory barriers and they are.

I'm not an expert, but there is no ReadRead/acquire barrier
in case if table_is_ready is true. IIUC, it would be a problem
if you are targeting IA-64 using non-msvc or msvc before 8.0 (2005).
Could you detect and #error on such arch/compiler combinations?

>> shared/localization_backend.cpp:
>> lines 200, 206: This is not guaranteed to be thread-safe
>> in C++03. You must use call_once for thread-safe
>> static inititalization. Note however that this is
>> probably safe if you assume that no additional
>> threads are started before main.
> This mutexes are explicitly globally initialized
> later.
> So all such things should be solved on library start.

Some compilers might not execute init::init() ctor as
the do_init variable is not used. Also, could you comment
your assumptions in the code?

> So I think that is would be good enough and call_once
> would just inject additional dependency on Boost.Thread
> (currently Boost.Thread used in headers only variant
> when ICU is not used)

Boost list run by bdawes at, gregod at, cpdaniel at, john at