Shared and race conditions

Kagamin spam at here.lot
Mon Dec 4 09:09:58 UTC 2017


On Wednesday, 29 November 2017 at 16:13:13 UTC, Wanderer wrote:
> static void getId(shared IdGen!(MyId)* g)
> {
>     writeln("next: ", g.next());
>     writeln("next: ", g.next());
> }

writeln synchronizes on stdout, so your code is mostly 
serialized, good example of a very subtle race condition.


More information about the Digitalmars-d-learn mailing list