synchronized - shared but actually useful

FeepingCreature feepingcreature at gmail.com
Fri Jul 1 08:25:03 UTC 2022


On Friday, 1 July 2022 at 07:42:07 UTC, Ola Fosheim Grøstad wrote:
> On Friday, 1 July 2022 at 07:13:23 UTC, FeepingCreature wrote:
>> Apropos of running into a production threading error that 
>> would have been fixed by this synchronized proposal, let me 
>> just bump this thread to note that it's four years later and 
>> this code still fails to compile for absolutely zero reason:
>>
>> ```
>> synchronized class A
>> {
>>     private int e;
>>     void foo() { e++; }
>> }
>> ```
>
> That is a weird bug, it works for ‘e=e+1’?

Huh... cool!

I've ran into some issues with trying it in a somewhat nontrivial 
class (it doesn't really interact with associative arrays 
correctly), but if this *should* work now, I'm going to try it on 
simpler classes. Maybe it's good now for some cases!


More information about the Digitalmars-d mailing list