synchronized - shared but actually useful

FeepingCreature feepingcreature at gmail.com
Wed Oct 31 09:45:32 UTC 2018


On Wednesday, 31 October 2018 at 09:41:58 UTC, Stanislav Blinov 
wrote:
> On Wednesday, 31 October 2018 at 09:36:22 UTC, FeepingCreature 
> wrote:
>
>> it seems like it should at least be possible to require that 
>> the Thread runner only accesses shared data, by limiting it to 
>> take a pure function that only has synchronized-class 
>> parameters. Well, it would be, if there was a trait for 
>> synchronized classes, but that seems like it'd be much easier 
>> to add.
>
> And so you're jumping from your "simple oop cases" to "let's 
> infect the runtime with a narrow-minded view of thread-safety 
> and inflict synchronization on everyone using threads"? And 
> what if anyone, deity forbid, wants to pass data that is not 
> actually mutex-protected, because they happen to know that 
> there's a lot more to synchronizing data access than that?

Sorry, allow me to restate this.

It seems like it should be possible that we, in our utility 
libraries, write a Thread wrapper that actually enforces that 
<see above>.


More information about the Digitalmars-d mailing list