[Issue 318] New: wait does not release thread resources on Linux
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Sep 2 11:58:49 PDT 2006
http://d.puremagic.com/issues/show_bug.cgi?id=318
Summary: wait does not release thread resources on Linux
Product: D
Version: 0.165
Platform: All
OS/Version: Linux
Status: NEW
Severity: blocker
Priority: P2
Component: Phobos
AssignedTo: bugzilla at digitalmars.com
ReportedBy: mclysenk at mtu.edu
While wait is supposed to release a thread's resources, it will fail if the
thread has already completed. This makes it impossible to use more than 400
threads reliably. Here is an example which demonstrates the problem:
import std.stdio, std.thread;
void main()
{
for(int i=0; i<80000; i++)
{
writefln("Creating thread %d", i);
Thread t = new Thread({writefln(" Created!"); return 0;});
t.start;
for(int x=0; x<1000; x++)
Thread.yield;
t.wait;
writefln(" Finished.");
}
}
Within a few hundred iterations, this code will likely produce a "failed to
start" error. From my testing, this issue only affects Linux.
So far, there are no workarounds.
--
More information about the Digitalmars-d-bugs
mailing list