changeset 409:8d62834490d8

Fixed (I hope) problem with monitor/synchronized stuff not being properly initialized on Windows.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Sun, 27 Jul 2008 15:03:04 +0200
parents dc7dff3ce72e
children b4c2056038bf
files tango/lib/compiler/llvmdc/dmain2.d
diffstat 1 files changed, 15 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/tango/lib/compiler/llvmdc/dmain2.d	Sun Jul 27 14:32:51 2008 +0200
+++ b/tango/lib/compiler/llvmdc/dmain2.d	Sun Jul 27 15:03:04 2008 +0200
@@ -87,13 +87,12 @@
 
 void _d_criticalInit()
 {
-    version (linux)
-    {
-        _STI_monitor_staticctor();
-        _STI_critical_init();
-    }
+    _STI_monitor_staticctor();
+    _STI_critical_init();
 }
 
+// this is here so users can manually initialize the runtime
+// for example, when there is no main function etc.
 extern (C) bool rt_init( void delegate( Exception ) dg = null )
 {
     _d_criticalInit();
@@ -119,13 +118,12 @@
 
 void _d_criticalTerm()
 {
-    version (linux)
-    {
-        _STD_critical_term();
-        _STD_monitor_staticdtor();
-    }
+    _STD_critical_term();
+    _STD_monitor_staticdtor();
 }
 
+// this is here so users can manually terminate the runtime
+// for example, when there is no main function etc.
 extern (C) bool rt_term( void delegate( Exception ) dg = null )
 {
     try
@@ -168,12 +166,9 @@
     char[][] args;
     int result;
 
-    version (linux)
-    {
-        debug(PRINTF) printf("main ctors\n");
-        _STI_monitor_staticctor();
-        _STI_critical_init();
-    }
+    debug(PRINTF) printf("main ctors\n");
+    _STI_monitor_staticctor();
+    _STI_critical_init();
 
     debug(PRINTF) printf("main args\n");
     version (Win32)
@@ -288,11 +283,9 @@
 
     tryExec(&runAll);
 
-    version (linux)
-    {
-        debug(PRINTF) printf("main dtor\n");
-        _STD_critical_term();
-        _STD_monitor_staticdtor();
-    }
+    debug(PRINTF) printf("main dtor\n");
+    _STD_critical_term();
+    _STD_monitor_staticdtor();
+
     return result;
 }