A quick way to replicate the old behavior using synchronized(Object)
downs
default_357-line at yahoo.de
Fri Jun 27 08:46:49 PDT 2008
gentoo-pc ~ $ cat test50.d; echo "==="; gdc test50.d -o test50 && ./test5
0
import std.stdio;
template _SyncObject(string KEY) {
Object obj;
static this() { obj = new Object; }
}
template SyncObject(string KEY) {
alias _SyncObject!(KEY).obj SyncObject;
}
void main() {
writefln(SyncObject!("main_1") is SyncObject!("main_1"));
writefln(SyncObject!("main_1") !is SyncObject!("main_2"));
synchronized (SyncObject!("main_1")) {
writefln("Test");
}
}
===
true
true
Test
More information about the Digitalmars-d
mailing list