www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Shared value types can not be destructed

reply Benjamin Thaut <code benjamin-thaut.de> writes:
Apperently this is by design:
http://d.puremagic.com/issues/show_bug.cgi?id=8295

To clarify: It is not possible to define a destructor that will be 
called on the destruction of a shared struct.

In a different thread Walter commeted this bug with:
"If you include an object designed to work only in a single thread 
(non-shared), make it shared, and then destruct it when other threads 
may be pointing to it ...

What should happen?"

I did try to think of a case where his scenario would actually break 
something, but couldn't find one. If someone has more knowdelge about 
this situation some clarification would be great. Maybe even a small 
code sample that illustrates the problem.

Kind Regards
Benjamin Thaut
Nov 13 2012
parent Benjamin Thaut <code benjamin-thaut.de> writes:
Am 13.11.2012 17:25, schrieb Benjamin Thaut:
 Apperently this is by design:
 http://d.puremagic.com/issues/show_bug.cgi?id=8295

 To clarify: It is not possible to define a destructor that will be
 called on the destruction of a shared struct.

 In a different thread Walter commeted this bug with:
 "If you include an object designed to work only in a single thread
 (non-shared), make it shared, and then destruct it when other threads
 may be pointing to it ...

 What should happen?"

 I did try to think of a case where his scenario would actually break
 something, but couldn't find one. If someone has more knowdelge about
 this situation some clarification would be great. Maybe even a small
 code sample that illustrates the problem.

 Kind Regards
 Benjamin Thaut
anyone?
Nov 14 2012