d2 shared delegate problem
AxelS
a_bothe at gmx.net
Sun May 24 09:44:56 PDT 2009
Hello everybody, directly to my problem:
In class A I got a static array of delegates...
class A{
private static alias void delegate() EventHandler;
public static EventHandler[] MyEvent;
static void Foo()
{
foreach(eh; MyEvent) eh();
}
}
...and when I call Foo() from another Thread like...
import core.thread;
void main()
{
A.MyEvent~=() { std.stdio.writeln("MyEvent"); }
Thread th=new Thread((){
A.Foo();
});
th.start();
}
...my program says anything...so I set MyEvent to be shared...
But now, after running my program it says that there is a stack overflow...
Where's the reason for this?
More information about the Digitalmars-d-learn
mailing list