|
Boost Users : |
Subject: Re: [Boost-users] [system] local static and threading in C++03
From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2012-12-27 15:32:49
On Thu, Dec 27, 2012 at 5:42 PM, Vicente Botet <vicente.botet_at_[hidden]> wrote:
> Felipe Magno de Almeida wrote
>> On Thu, Dec 27, 2012 at 9:30 AM, Vicente Botet <
>
>> vicente.botet@
[snip]
>>> Form a theoretical point of view yes. But in practice, which observable
>>> problems could induce the double construction?
>
> Could you answer this question?
I don't think I can. It is a race condition. What can happen? Anything I guess,
it would depend on the implementation. I do feel very uneasy about concurrency
bugs. They do bite.
>>> I would expect only one destruction, don`t you?
>>
>> No, I wouldn't. If it is constructed twice, I would expect atexit to be
>> called
>> twice as well. So double destruction.
>
> I don`t know. Anyway, which observable problems could induce this double
> destruction?
I think double-free of allocated memory is quite possible, but I think anything
is possible depending on implementation details. I rather not rely on
implementation
details.
Also, I was expecting race conditions to be taken more seriously than
to wait for
bad behavior to appear. It is, afterall, a correctness issue.
[snip]
>>> This approach would make both libraries interdependent.
>>
>> I don't understand what you mean.
>
> Boost.System will depend on Boost.Thread and Boost.Thread already depends on
> Boost.System.
I see. I rather they be interdependent than to have race conditions.
And I don't think call_once
requires boost.system. So at least cyclic includes could be avoided.
> Best,
> Vicente
Regards,
-- Felipe Magno de Almeida
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net