www.digitalmars.com         C & C++   DMDScript  

D - try_synchronized (or equivalent) needed

reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
I like that we can do
	synchronized(<Object>) statement;

But sometimes I want to be able to detect (and avoid) deadlocks, and it 
would be nice to be able to do that with the same synchronized() syntax.

How about this:
	try_synchronized(<Object>) statement; else statement;
(the 'else' runs if you can't immediately grab the lock).

Or else, is ther already some way to do this, Walter?
Jan 31 2004
parent yaneurao <yaneurao_member pathlink.com> writes:
In article <bvgheq$1lbn$1 digitaldaemon.com>, Russ Lewis says...
How about this:
	try_synchronized(<Object>) statement; else statement;
(the 'else' runs if you can't immediately grab the lock).

it sounds good. sometimes I also want such syntax for balking. yaneurao.
Jan 31 2004