On 12/4/17 4:09 AM, Kagamin wrote:
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.

Well, this is just why you don't see output items that are mixed lines (i.e. "nenext: 1\nxt: 2\n" instead of "next: 1\nnext: 2\n")

The next calls are not synchronized.

-Steve

Reply via email to