The "no gc" crowd

Dicebot public at dicebot.lv
Fri Oct 11 11:19:57 PDT 2013


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?


More information about the Digitalmars-d mailing list