Documentation of object.destroy
Steven Schveighoffer
schveiguy at yahoo.com
Tue Jan 2 20:21:09 UTC 2018
On 1/2/18 3:07 PM, jmh530 wrote:
> On Tuesday, 2 January 2018 at 17:16:54 UTC, Steven Schveighoffer wrote:
>>
>> It does something different depending on the type:
>>
>> Objects: calls rt_finalize on the object, which calls the dtor,
>> deletes the monitor, rewrites the init value to the object, and THEN
>> zeroes the vtable ptr. This last step makes it inoperable for anyone
>> still holding a pointer to the object. This is why I think the docs
>> are written the way they are.
>
>
> What's the monitor do? I see that in the ABI documentation, but it
> doesn't really explain it...
The monitor is used to lock any object for synchronization.
It's allocated on demand.
https://dlang.org/spec/class.html#synchronized-classes
-Steve
More information about the Digitalmars-d
mailing list