question

fred fred.smeagol at gmail.com
Wed Dec 13 12:49:14 UTC 2023


import core.thread;
import std.concurrency;
import std.stdio : w = writeln;

     void w2(shared(bool) *done)
     {
     	while (*done == false)
     	{
     		Thread.sleep(100.msecs);
     		w("print done? ", *done);
     	}
     }

     void s2()
     {
     	shared(bool) isDone = false;
     	spawn(&w2, &isDone);
     	Thread.sleep(400.msecs);
     	isDone = true;

}

     void main()
     {
     	s2();
     }

=========

a bug ?
thanks anyway


More information about the Digitalmars-d-learn mailing list