The "no gc" crowd
Sean Kelly
sean at invisibleduck.org
Fri Oct 11 11:18:43 PDT 2013
On Friday, 11 October 2013 at 18:10:27 UTC, Dicebot wrote:
>
> I was reading this :
> http://dlang.org/statement.html#SynchronizedStatement
>
> It says that Expression in sync statement must evaluate to
> Object or interface and mutex get created specifically for it.
> But what if I want to use struct in that block? Or array?
Synchronize on a dummy object or use core.sync.mutex:
auto m = new Mutex;
synchronized(m) {
}
It's effectively the same as in C++ except that synchronized
saves you the trouble of using an RAII scoped_lock variable.
More information about the Digitalmars-d
mailing list