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
Previous text:
2003-02-05 08:39: Subject: synchronized
The synchronized keyword without arguments could possibly block all other threads ("disallow threads"-like). I've had a few programs where I would have been satisfied with that, even if it's a daft solution. :)
Otherwize, a synchronized like
mapping locks_n_stuff=set_weak_flag(([]),1);
mixed synchronized(mixed var, function f) { object lock;
if (mutexp(var)) lock=var; else if (locks_n_stuff[var]) lock=locks_n_stuff[var]->lock(); else lock=locks_n_stuff[var]=Thread.Mutex();
object key=lock->lock(); // lock(1)? mixed r = f(); destruct(key); return r; }
might work, it could take functions as arguments,
void my_func() { syncronized(my_func) { .... } }
/ Mirar