An Issue I Wish To Raise Awareness On

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 18 11:06:56 PDT 2017


On Tuesday, 18 July 2017 at 15:03:07 UTC, Kagamin wrote:
> On Tuesday, 18 July 2017 at 11:47:37 UTC, Petar Kirov 
> [ZombineDev] wrote:
>> I think Atila was talking about this one:
>> struct A
>> {
>> 	~this() {}
>> }
>>
>> void main()
>> {
>> 	auto a = A();
>> 	shared b = A();
>> }
>
> This is strange. There's nothing that suggests that struct A 
> and its destructor is thread-safe, yet compiler assumes it is.

Except for a programmer explicitly and manually calling the 
destructor (in which case, don't), the destructor is only ever 
called by one thread.

Atila


More information about the Digitalmars-d mailing list