|
Boost : |
Subject: Re: [boost] [thread] terminating destructor
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-10-25 13:11:55
Le 25/10/12 10:22, Olaf van der Spek a écrit :
> On Thu, Oct 25, 2012 at 10:11 AM, Andrzej Krzemienski
> <akrzemi1_at_[hidden]> wrote:
>> 2012/10/25 Olaf van der Spek <ml_at_[hidden]>
>>
>>> On Thu, Oct 25, 2012 at 9:56 AM, Andrzej Krzemienski <akrzemi1_at_[hidden]>
>>> wrote:
>>>> The third situation below shows a non blocking ~future. But such
>>> execution
>>>> is *disallowed *by the standard because the completion of launched thread
>>>> would not synchronize with the last release of the shared state.
>>> The big question is: why?
>>>
>>> Can't the destructor detach from the shared state and let the state be
>>> cleaned up by the launched thread?
>>
>> According to my (limited) understanding of the standard: no. Because, as
>> per requirement in Sect 30.6.8 paragraph 5, the "launched" thread
>> completion must synchronize with (happen before) the last function that
>> releases the shared state.
>>
>> If the launched thread finishes before the release, the thread cannot
>> perform this release.
> But why? What's the rationale for this requirement?
> Is it the same rationale as the thread destructor of a non-detached
> thread terminating (for safety)?
>
>
Oh I guess I start to understand the standard rationale.
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk