Thread + socket = (shared) problem? (2.048)
Bane
branimir.milosavljevic at gmail.com
Tue Sep 7 07:03:41 PDT 2010
I triple checked it. 2.0.48 has problems with this, 2.040, 2.045 & 2.047 don't.
> This will throw exception on trying to create socket in derived thread. Socket created in main thread is ok. Is it some shared issue or... ? I have been trying to find something info in docs and mailing list but no result.
>
> import std.stdio;
> import core.thread;
> import std.socket;
>
> class MyThread : Thread {
> Socket sock;
> this(){
> super(&run);
> }
> void run(){
> writeln("thread start");
> sock = new TcpSocket; // this will throw exception on 2.047, 2.048
> writeln("thread end");
> }
> }
>
> void main(){
> writeln("main start");
> auto s = new TcpSocket;
> writeln("socket in main thread created");
> auto t = new MyThread;
> t.start;
> writeln("main end");
> }
More information about the Digitalmars-d
mailing list