Forum Navigation
Tango and thread with Stdout
Posted: 10/25/07 12:08:26 Modified: 10/25/07 13:23:04I have made this source code and I don't know if Stdout can work with thread :
import tango.core.Thread; import tango.io.stdout; class HelloThread? : Thread
{
this() {
super( &run );
}
private :
void run() {
while(true)Stdout( "Derived thread running.\n" )();
}
}
int main(char[][] args) { // create instances of each type
HelloThread? derived_1 = new HelloThread?(); HelloThread? derived_2 = new HelloThread?(); HelloThread? derived_3 = new HelloThread?(); HelloThread? derived_4 = new HelloThread?(); HelloThread? derived_5 = new HelloThread?();
// start both threads derived_1.start();
derived_2.start(); derived_3.start(); derived_4.start(); derived_5.start(); while(true) Stdout("Thread Principal")();
return 0;
}
this code on XP with DMD and tango return this message :
Derived thread running. Derived thread running. Derived thread running. Derived thread running. Derived thread running. Derived thread running. Derived thread running. Derived thread running. Derived thread running. Derived thread running. object.Exception: Access Violation object.Exception: Access Violation
Process returned 1 (0x1) execution time : 0.110 s Press any key to continue.
This is same with one thread