It would only harm if we want synchronized() to have some other semantics in the future. Do we?
But this would work as implicit-lock creator too, so I think it's nice and does what you want<tm>:
syncronized("superlock") { ... } // global keyword :)
class Foo { syncronized(Foo) { ... } // class-global lock syncronized(this_object()) { ... } // object-global lock
mapping m; ... syncronized(m) { ... } // only blocks on the same m instance ... m=copy_value(m); // ignore all current threads working :) }
It's just sad you can't use it like this (or can you?):
class Bar { syncronized my_func() { ... } or syncronized(this_object()) my_func() { ... } }
/ Mirar
Previous text:
2003-02-05 08:45: Subject: synchronized
That one seems like a winner to me to add. I mean, it's easy and doesn't harm anything - might as well add it as a feature, perhaps as simple as Thread.synchronize(...) { } where you could import it to remove the Thread part.
/ David Hedbor