On Friday, 11 October 2013 at 18:18:45 UTC, Sean Kelly wrote:
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.
Yeah, but it can't possibly work in conjunction with proposed
"shared" stripping inside the block, can it?