Boost logo

Boost :

Subject: Re: [boost] [thread] terminating destructor
From: Christof Donat (cd_at_[hidden])
Date: 2012-10-25 04:33:24


>> 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?

That is what I thought in the first place as well. Yet, the object to
will live on the stack of the main thread. Before the function can
return, the
stack frame has to be released and therefore the objects in it have to
destroyed. When the destruction is done by the launched thread, either
the main
thread has to wait and there is nothing you can gain that way, or the
would need to be forkable. That would break almost all C++ ABIs around
world, I guess.


okunah gmbh                                  Software nach Maß
Zugspitzstr. 211                       
86165 Augsburg                                    cd_at_[hidden]
                                       Registergericht Augsburg
Geschäftsführer                             Augsburg HRB 21896
Christof Donat                           UStID: DE 248 815 055

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