[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: condition variables and mutexes

This page is part of the web mail archives of SRFI 18 from before July 7th, 2015. The new archives for SRFI 18 contain all messages, not just those from before July 7th, 2015.

> I can't see any reason this re-acquisition must necessarily be part of
> the waiting operation --- clearly, the awakened thread must wait its
> turn for the mutex, like everyone else.  But I think it is easier to
> reason about: the invariant "I've got the mutex" holds upon entry and
> exit to the waiting operation --- just not while it's waiting.
> If this is a deliberate choice, it's an unusual one, and there should
> be some rationale given in the SRFI.
> If you decide to change the SRFI's waiting operation to more closely
> resemble those provided by the other systems, then I think it should
> be given its own name, instead of being attached to `mutex-unlock!'
> --- it would be odd indeed for a function named `mutex-unlock!' to
> return with the mutex still locked.  `condition-variable-wait!' would
> be one possibility.

You are right.  I'll make the change.