digitalmars.D.learn - Threads and concurrency
- Charles (28/28) Nov 08 2005 While on the subject of Threads would someone please hit me w/ the clue ...
While on the subject of Threads would someone please hit me w/ the clue bat b/c I can't seem to get the following working. This example should just call mthread.run since I've overloaded it . But that's not what happens. It just call the mthread constructor and finishes. I'd also appreciate any links to some beginner Thread examples in D. I'm sure the locks code would come in handy at some point but I'm not there yet. int main () { mthread m = new Thread(); m.run(); // <== this should call mthread.run but it just calls the constructor return 0; } module mthread; import std.thread; class mthread : Thread { this () { super(); std.string.writefln("S thread cons"); std.string.writefln("E thread cons"); } ~this() { } int run () { foo(); } void foo () { std.string.writefln("inside foo"); } void bar () { std.string.writefln("inside bar"); } }
Nov 08 2005