Mercurial > projects > dwt2
diff base/src/java/lang/ThreadLocal.d @ 112:9f4c18c268b2
Update to compile and execute with dmd 2.052.
author | kntroh |
---|---|
date | Wed, 16 Mar 2011 21:53:53 +0900 |
parents | 5d5bd660917f |
children |
line wrap: on
line diff
--- a/base/src/java/lang/ThreadLocal.d Sat Nov 13 14:15:51 2010 +0100 +++ b/base/src/java/lang/ThreadLocal.d Wed Mar 16 21:53:53 2011 +0900 @@ -1,22 +1,39 @@ module java.lang.ThreadLocal; import java.lang.util; -static import tango.core.Thread; +version(Tango){ + static import tango.core.Thread; -class ThreadLocal{ - alias tango.core.Thread.ThreadLocal!(Object) TLSType; - TLSType tls; - this(){ - tls = new TLSType( initialValue() ); + class ThreadLocal{ + alias tango.core.Thread.ThreadLocal!(Object) TLSType; + TLSType tls; + this(){ + tls = new TLSType( initialValue() ); + } + Object get(){ + return tls.val(); + } + protected Object initialValue(){ + return null; + } + void set(Object value){ + return tls.val( value ); + } } - Object get(){ - return tls.val(); - } - protected Object initialValue(){ - return null; - } - void set(Object value){ - return tls.val( value ); +} else { // Phobos + class ThreadLocal{ + Object tls; + this(){ + tls = initialValue(); + } + Object get(){ + return tls; + } + protected Object initialValue(){ + return null; + } + void set(Object value){ + return tls = value; + } } } -