https://d.puremagic.com/issues/show_bug.cgi?id=11981
Stanislav Blinov <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #2 from Stanislav Blinov <[email protected]> 2014-02-08 16:33:53 PST --- Don't know how useful this could be but... This code: import std.concurrency; import core.memory; import core.thread; import core.atomic; import std.stdio; // Reduced from host unittest version(all) // version(none) avoids deadlock { shared uint tctor, tdtor; static this() { auto v = atomicOp!"+="(tctor,1); writefln(" new thread %s", v); } static ~this() { auto v = atomicOp!"+="(tdtor,1); writefln(" cleanup %s", v); } } void main() { enum uint numThreads = 16; long i = 0; while(true) { writefln("Starting run %s", i); shared uint finished; foreach(immutable t; 0..numThreads) { spawn((shared uint* f) { atomicOp!"+="(*f, 1); }, &finished); } long n = 0; while (atomicLoad!(MemoryOrder.acq)(finished) != numThreads) { writefln("suspend %s", n); thread_suspendAll(); writefln("resume %s", n); thread_resumeAll(); ++n; } thread_joinAll(); writefln("Run %s done", i); ++i; } } deadlocks in every single run on my machine (though randomly in each run). $uname -a Linux 3.8.0-26-generic #38-Ubuntu SMP Mon Jun 17 21:43:33 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux $ldd --version ldd (Ubuntu EGLIBC 2.17-0ubuntu5.1) 2.17 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
