synchronized - shared but actually useful

FeepingCreature feepingcreature at gmail.com
Tue Oct 23 13:37:26 UTC 2018


On Tuesday, 23 October 2018 at 12:50:30 UTC, Stanislav Blinov 
wrote:
> On Tuesday, 23 October 2018 at 08:56:39 UTC, FeepingCreature 
> wrote:
>> 1. Make synchronized an attribute of fields, classes and 
>> methods
>> ...
>>
>> Advantages:
>> * simple
>> * does something useful
>> Disadvantages:
>> * inability to generate giant forum debates (fingers crossed)
>
> :) What about structs? Or all the cases where you don't need 
> 'synchronized'? You can write a lock-free queue with a few 
> integers and an array.

That's why I tied it to @safe, so you can always write 
synchronized @trusted code that needs manual thread safety. That 
said, clever threading solutions, atomics and the like are mostly 
out of scope for this proposal, which is primarily aimed at 
simple oop-based code.


More information about the Digitalmars-d mailing list