[Issue 3054] New: multithreading GC problem. And Stdio not multithreading safe
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jun 6 08:08:58 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3054
Summary: multithreading GC problem. And Stdio not
multithreading safe
Product: D
Version: 2.028
Platform: Other
OS/Version: Windows
Status: NEW
Severity: critical
Priority: P2
Component: Phobos
AssignedTo: bugzilla at digitalmars.com
ReportedBy: davidl at 126.com
import core.thread;
import std.stdio;
class threadid
{
static int threadid;
static int threadnum;
int getId(){threadid++; return threadid; }
}
threadid TID;
void main()
{
TID = new threadid;
while(true)
{
try
{
synchronized(TID) if (TID.threadnum<500)
{
auto stress = (new Thread(
(){
int tid;
synchronized(TID){ tid = TID.getId(); }
scope(exit) synchronized(TID){TID.threadnum--;}
synchronized(TID){TID.threadnum++;}
//writefln("new thread:", tid, TID.threadnum);
void[] buffer;
try
{
buffer.length= 65536;
}
catch(Exception e)
{
writefln("thread:", tid);
writefln(e.msg);
}
}
));
stress.start();
}
//writefln("outside:", TID.threadnum);
}
catch(Exception e)
{
//writefln("error: ", e.msg);
}
}
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list