An Issue I Wish To Raise Awareness On

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 21 04:57:11 PDT 2017


On Friday, 21 July 2017 at 08:51:27 UTC, Atila Neves wrote:
> Mutexes and sockets are classes, so not destroyed 
> deterministically.

They should, like any unmanaged resources, e.g. by wrapping in a 
smart pointer. Imagine 10000 lingering tcp connections 
accumulated over time due to poor timing of destruction, it 
becomes a stress test for the server.

> Anything that is `shared` is likely to be a reference (pointer, 
> class...), or a global. Either way the compiler-generated 
> destructor call isn't going to exist, which means it's probably 
> ok to cast away shared when the compiler inserts the automatic 
> call to a destructor at the end of scope.

These are contradictory. Does the automatic destructor call exist 
or not?


More information about the Digitalmars-d mailing list