Bug 1126 – multithreading breaks phobos exceptions on mingw/gdc .23

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2007-04-11T17:48:00Z
Last change time
2015-06-09T01:31:13Z
Assigned to
ibuclaw
Creator
default_357-line

Comments

Comment #0 by default_357-line — 2007-04-11T17:48:47Z
Consider the following code: import std.stdio, std.thread, std.socket; // intended to fail void cause_throw() { Socket s=new TcpSocket(new InternetAddress("bogus", 80)); } void main() { (new Thread(() { while (true) { } return 0; })).start; try cause_throw; catch (Exception e) { writefln("Exception: ", e); } writefln("Returning"); } Now, if I comment the thread out, I get, as expected: Exception: Unable to resolve etc. Returning However, if I leave it as it is, I get "Error: Unable to resolve etc.", and the program freezes. I was unable to find another gdc/mingw user to verify it. Tried on a virgin 3.4.5/.23 and .22 and on a 4.0.2/.23 gdc MinGW setup. The problem seems to be specific to gdc/win32.
Comment #1 by ibuclaw — 2012-09-07T02:44:09Z
Seems to be correct as of testing the sample on D2. ---- import std.stdio, core.thread, std.socket; // intended to fail void cause_throw() { Socket s=new TcpSocket(new InternetAddress("bogus", 80)); } void main() { (new Thread(() { while (true) { } })).start; try cause_throw; catch (Exception e) { writeln("Exception: ", e); } writeln("Returning"); }