[Bordeaux-threads-devel] [Updated3] Patch for ABCL against BORDEAUX-THREADS HEAD

Martin Simmons martin at lispworks.com
Wed Mar 2 19:50:05 UTC 2011


>>>>> On Tue, 01 Mar 2011 16:18:35 +0100, Mark Evenson said:
> 
> After critique from Stellian, I have [successfully brought my patches in 
> alignment with BORDEAUX-THREADS GIT head][1].
> 
> Please review this for inclusion.
> 
> [1]: http://slack.net/~evenson/abcl/bordeaux-threads-abcl-20110301a.diff

I think that the implementation of condition-wait has some major problems:

1) If no other threads are trying to claim the lock, then condition-wait will
return immediately rather than waiting.

2) If two threads are waiting in condition-wait and two other threads call
condition-notify, then it is possible that only one thread will return from
condition-wait because the call to acquire-lock in one of them might return
nil causing it to wait again.

3) If condition-notify is called by one thread when a waiting thread is just
about to enter the threads:synchronized-on form (but before it gets
synchronized), then the notify will be lost.  This happens because the
underlying threading primitives have no "memory" of calls to notify when
nothing it waiting (which is also the expected semantics for POSIX condition
variables BTW).

Also, I think condition-notify should be using threads:object-notify rather
than threads:object-notify-all.

-- 
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/




More information about the bordeaux-threads-devel mailing list