[Issue 5183] WinSock error occurs when socket is created in thread other than main

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 6 18:36:00 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5183



--- Comment #1 from Andrew Wiley <debio264 at gmail.com> 2010-11-06 18:35:01 PDT ---
Okay, after adding some debugging writeflns to std.socket, the output is now
this:
initializing WSA
Initializing socket
success!
cleaning up WSA
Initializing socket
Error: 10093
cleaning up WSA

So the problem is that the module destructor for std.socket is called when the
first thread terminates, even though the second thread still needs it.

This is because the module constructor for std.socket is "shared static this()"
while the destructor is "static this()". Adding "shared" causes the code to run
successfully.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list