On Monday, 31 August 2015 at 14:18:43 UTC, byron wrote:
```
class MyResource
{
void* handle;
this()
{
handle = create_handle();
}
close()
{
if (handle !is null)
{
synchronized {
if (handle !is null) {
free_handle(handle);
}
}
handle = null;
}
}
~this()
{
close();
}
}
```
Used to do like that modulo the synchronized (which makes sense considering destructors are run after all threads are unpaused). The problem is that relying on GC destructors tends to come bite later imho.
