Re: Thread + socket = (shared) problem? (2.048)

2010-09-09 Thread Bane
Thank you for your reply. I have been migrating some socket/thread code from D1 to D2 lately. One of changes is that Thread.this() must have super(run) in it. It seems when one of the thread doesn't have that line, strange things happen. Can anyone confirm this code to reproduce error: import

Thread + socket = (shared) problem? (2.048)

2010-09-07 Thread Bane
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

Re: Thread + socket = (shared) problem? (2.048)

2010-09-07 Thread Bane
This is what I get: std.socket.SocketException: Unable to create socket

Re: Thread + socket = (shared) problem? (2.048)

2010-09-07 Thread Bane
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

Re: Thread + socket = (shared) problem? (2.048)

2010-09-07 Thread Bane
Errr... sorry guys. Joke is on me. Main threads exits before socket is created in new thread. Simple call to sleep() fix this.

Re: Thread + socket = (shared) problem? (2.048)

2010-09-07 Thread Masahiro Nakagawa
On Tue, 07 Sep 2010 18:48:22 +0900, Bane branimir.milosavlje...@gmail.com wrote: Please show your environment. Windows? WinXP sp2, phenom quad core. Current std.socket uses static ~this for WSACleanup. In this case, main thread calls static ~this before MyThread executes new TcpSocket.