[Bordeaux-threads-devel] Clarifying some behavior in the documentation
Martin Simmons
martin at lispworks.com
Tue Nov 30 12:27:28 UTC 2010
>>>>> On Tue, 30 Nov 2010 00:02:05 -0500, Vladimir Sedach said:
>
> Hello,
>
> I've encountered two cases that affect behavior of code but aren't
> clarified in the documentation:
>
> 1. At least one implementation (SBCL) requires that the lock on which
> condition-wait is called is to be held by the thread that calls
> condition-notify on the corresponding CV. This should be mentioned in
> the documentation as a requirement.
Yes, this is a standard, but ill-documented, requirement for condition
variables. The lock is needed to synchronize the notify with the change to
the underlying data in the application.
> 2. It is undefined what happens when release-lock is called inside a
> with-lock-held on the same lock. SBCL and Clozure appear to handle
> this "properly," although I think the documented behavior should be
> the same as with regular release-lock ("It is an error to call this
> unless the lock has previously been acquired (and not released) by the
> same thread," that is, it should be an error to call release-lock
> inside a with-lock-held).
I think release-lock can be allowed inside with-lock-held, as long as you call
acquire-lock before exiting the body.
--
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/
More information about the bordeaux-threads-devel
mailing list