RFC: safe ref counting

Eduard Staniloiu edi33416 at gmail.com
Tue Oct 27 23:55:04 UTC 2020


On Saturday, 2 May 2020 at 02:27:10 UTC, Steven Schveighoffer 
wrote:
> In trying to make iopipe @safe, I came to the realization that 
> having auto-managed items such as files and the like (std.io 
> Files and Sockets are non-copyable), you need to rely on some 
> form of @safe reference counting. Unfortunately 
> std.typecons.RefCounted is not and cannot be safe. This is 
> because it allocates in the C heap, and deallocates regardless 
> of whether anyone has ever squirreled away a reference.
>
> [...]

I’m late to the party.

I think you could use one of the allocation schemes proposed by 
Alexandru Jercaianu in his dconf talk [2]

[2] - https://youtu.be/kaA3HPgowwY


More information about the Digitalmars-d mailing list