The "no gc" crowd

Dicebot public at dicebot.lv
Fri Oct 11 11:10:23 PDT 2013


On Friday, 11 October 2013 at 18:05:00 UTC, Sean Kelly wrote:
> On Friday, 11 October 2013 at 17:50:26 UTC, Dicebot wrote:
>>
>> How can one possibly used "synchronized" for this in absence 
>> of classes if desire behavior is to lock an entity, not 
>> statement block?
>
> I'm not sure I follow.  But I was in part objecting to the use 
> of synchronized without a related object:
>
> synchronized {
>     // do stuff
> }
>
> This statement should be illegal.  You must always specify a 
> synchronization context:
>
> synchronized(myMutex) {
>     // do stuff
> }
>
> For the rest, it seemed like the suggestion was that you could 
> just wrap a statement in any old synchronized block and all 
> your problems would be solved, which absolutely isn't the case.


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?


More information about the Digitalmars-d mailing list