Hi,

At Thu, 17 May 2007 03:25:05 +0900,
Pete wrote in [ruby-talk:251828]:
> >Since bmidi_ensure() won't get called until bmidi_doeach()
> >ends, the latter seems to success to acquire the semaphore only
> >when the callback released it.  At that time, the callback sets
> >receiving to false before the release, so the bmidi_ensure()
> >leaves the semaphore locked which acquired by bmidi_doeach(), I
> >guess.  In short, the sequence is wrong.
> Actually, no.  I think that part is correct.  The callback only
> releases the semaphore *if* the yield signals termination.

But receiving is left false, and then bmidi_doeach() acquires
the semaphore before bmidi_ensure() is called.

>The idea of the ensure was to release the semaphore if the callback hadn't
> -- i.e. if break bypassed the yield.

The ensure won't called until the callback released the
semaphore because doeach waits it.

-- 
Nobu Nakada