Correct way to create singleton?

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 10 12:13:45 PST 2016


On Thursday, November 10, 2016 14:25:49 Steven Schveighoffer via 
Digitalmars-d-learn wrote:
> There's a specific way to create a singleton that David Simcha outlined
> in a talk at dconf 2013, that avoids all the race condition issues that
> singletons traditionally have:
>
> https://davesdprogramming.wordpress.com/2013/05/06/low-lock-singletons/

And what's particular cool about it from the perspective of promoting D is
that it's _very_ easy to implement in D, whereas in most other languages, it
involves using constructs that many folks don't even know exist, let alone
know how to use (in particular, you need to use TLS).

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list