On Saturday, 5 May 2012 at 17:03:00 UTC, Chris Cain wrote:
On Saturday, 5 May 2012 at 09:28:34 UTC, Tongzhou Li wrote:
On Saturday, 5 May 2012 at 09:16:04 UTC, Kagamin wrote:
What's in console?
object.Error: Access Violation
----------------
----------------
Expected output:
12341234123....
PS:
Line 13 should be: write(Idx);
By default, everything is TLS (thread local) ... so, cv[0] will
be null in main even though another thread set it to something
else.
Adding __gshared in front of "Condition[4] cv;" on line 7 will
make it not crash with the Access Violation. However, I highly
recommend you read the concurrency chapter in the DPL book:
http://www.informit.com/articles/article.aspx?p=1609144
Thanks. Now it works fine with gdc, but still prints nothing with
dmd. It seems that "cv[0].notify()" on line 29 affects nothing at
all when using dmd2 :(