synchronized { }
cemiller
chris at dprogramming.com
Thu Jun 26 16:15:05 PDT 2008
I use it on occasion. It can be useful for singleton:
if(!foo)
{
synchronized
{
if(!foo)
foo = new Foo();
}
}
return foo;
especially useful because you don't need an object instance.
On Wed, 25 Jun 2008 18:18:41 -0700, Walter Bright
<newshound1 at digitalmars.com> wrote:
> Right now, if you use a synchronized statement with no argument, it will
> sync on a mutex unique to that statement.
>
> Does anyone write threading code that depends on this behavior?
More information about the Digitalmars-d
mailing list