The "no gc" crowd

Sean Kelly sean at invisibleduck.org
Fri Oct 11 11:22:43 PDT 2013


On Friday, 11 October 2013 at 18:19:59 UTC, Dicebot wrote:
> On Friday, 11 October 2013 at 18:18:45 UTC, Sean Kelly wrote:
>>
>> 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?

It should.  Stripping "shared" just means that you'll be able to 
call any function available on the struct as opposed to only 
explicitly shared functions.  And the mutex gives you atomic 
behavior (assuming you use the mutex properly anywhere else you 
access the struct).


More information about the Digitalmars-d mailing list