changeset 176:ed80c5c2b550

rm unneeded sync
author Frank Benoit <benoit@tionex.de>
date Fri, 12 Sep 2008 11:25:56 +0200
parents 9e7e1a8bc813
children 21c77bcb7887
files dwtx/dwtxhelper/JThread.d
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/dwtx/dwtxhelper/JThread.d	Fri Sep 12 09:44:36 2008 +0200
+++ b/dwtx/dwtxhelper/JThread.d	Fri Sep 12 11:25:56 2008 +0200
@@ -54,15 +54,12 @@
     public static JThread currentThread(){
         auto res = getTls().val();
         if( res is null ){
-            synchronized(JThread.classinfo){
-                res = getTls().val();
-                if( res is null ){
-                    res = new JThread();
-                    res.thread = Thread.getThis();
-                    getTls().val( res );
-                }
-            }
+            // no synchronized needed
+            res = new JThread();
+            res.thread = Thread.getThis();
+            getTls().val( res );
         }
+        assert( res );
         return res;
     }
     public int getPriority() {
@@ -121,6 +118,7 @@
         Thread.sleep(time/1000.0);
     }
     public Thread nativeThread(){
+        assert(thread);
         return thread;
     }
     public override char[] toString(){