spawning a thread in a class

Mike James foo at bar.com
Wed Jul 21 03:46:22 PDT 2010


I have some old serial comms code written in D1 + Tango and I'm going 
through the process of re-writing it for D2 + Phobos. The old code used 
Thread from the Tango library...

private Thread rxThread;
...
open() {
   ...
    rxThread = new Thread(&rxHandler);
    rxThread.start();
    ...
}

private rxHandler() {
    ...
}

The comms class worked fine (although I only ever used as 1 instance :-) )

I'm using the std.concurrency in Phobos to do the threading in the new 
version but I'm having problems passing the address of the receive handler. 
Are there any solutions to this - without making the receive handler static 
or outside the class :-)

Thanks.

-=mike=-



More information about the Digitalmars-d-learn mailing list