[RFC] "lock" statement and "mutex" type.

BCS BCS_member at pathlink.com
Wed Mar 15 09:30:57 PST 2006


Dejan Lekic wrote:
> My suggesion in form of lock(someMutex) {} else {} satisfies both type of
> concurrent programming fans. If you do not want lock to try, than just
> forget else block. :) Without else block lock() would behave like
> pthread_mutex_lock(), with else block it would behave like
> pthread_mutex_trylock() . Yes, i agree conditional variables should also be
> there, however i did not think so much about how to do it...
> 

One other thought: How should deadlock be handled?

options:
	1> it's not, that's the programmer's problem.
	2> some unspecified, the compiler/runtime just does it.
	3> multiple locks can be requested at the same time e.i.

		lock(mutex1, mutex2) // block untill mutex 1&2 can both be held

	   but no more can be acquired until the first ones are released.

	4> other.



More information about the Digitalmars-d mailing list