DMD 1.022 and 2.005 releases - what's wrong with threading?

downs default_357-line at yahoo.de
Sun Oct 7 01:29:40 PDT 2007


Frits van Bommel wrote:
> downs wrote:
>> Your implementation has, as far as I can tell, a fatal flaw. If
>> conditionWait is called before put, put's synchronized(this) will block
>> indefinitely.
>> Am I missing something here?
>>  --downs, confused
> 
> Yes, you seem to have missed the paragraph after the code. The
> conditionWait(this) atomically unlocks the synchronized(this) mutex and
> pauses the current thread, and then when resuming automatically relocks
> the mutex.
> This means that when conditionWait is called before put, get() will no
> longer have the mutex locked when put() is called, so the
> synchronized(this) in put() won't block (assuming no other thread has
> locked that mutex in the mean time).

Oh crap. Total spontaneous loss of reading comprehension. Sorry.
Thanks for pointing it out again.
 --downs



More information about the Digitalmars-d mailing list