diff dwt/graphics/Device.d @ 104:62a654ba5276

optimation of static ctors
author Frank Benoit <benoit@tionex.de>
date Fri, 18 Jan 2008 19:13:47 +0100
parents 5899e0b43e5d
children de2578a843a7
line wrap: on
line diff
--- a/dwt/graphics/Device.d	Fri Jan 18 17:00:39 2008 +0100
+++ b/dwt/graphics/Device.d	Fri Jan 18 19:13:47 2008 +0100
@@ -98,7 +98,7 @@
 
     static bool CAIRO_LOADED;
 
-    static Object CREATE_LOCK;
+//    static Object CREATE_LOCK;
 
     /*
     * TEMPORARY CODE. When a graphics object is
@@ -115,10 +115,10 @@
     protected static Device CurrentDevice;
     protected static Runnable DeviceFinder;
 
-synchronized static void static_this(){
-    CREATE_LOCK = new Object();
-    Devices = new Device[4];
-}
+//synchronized static void static_this(){
+//    CREATE_LOCK = new Object();
+//    Devices = new Device[4];
+//}
 /*
 * TEMPORARY CODE.
 */
@@ -156,12 +156,13 @@
  * @see #init
  * @see DeviceData
  */
+
 public this(DeviceData data) {
     handler_ids = new int [log_domains.length];
     debugging = DEBUG;
     tracking = DEBUG;
 
-    synchronized (CREATE_LOCK) {
+    synchronized ( this.classinfo ) {
         if (data !is null) {
             debugging = data.debugging;
             tracking = data.tracking;
@@ -558,7 +559,7 @@
     if (debugging) {
         if (xDisplay !is null) {
             /* Create the warning and error callbacks */
-            synchronized (CREATE_LOCK) {
+            synchronized (this.classinfo) {
                 int index = 0;
                 while (index < Devices.length) {
                     if (Devices [index] !is null) break;