Apologies folks for the cross-threading, this is related to the issue
many have experienced running SLIME on a threaded SBCL under Darwin
x86.
On 29-Aug-08, at 3:22 AM, Nikodemus Siivola wrote:
> No, sorry for my bogus knowledge. Last time I checked, which was
> probably during 10.4, the only timed wait I found was the IIRC
> SemaphoreWait or similar which did not like SBCL at all. (Mysterious
> messages to terminal is not usually a good sign...)
Support for a timeout value appears to be there for futexes, and I
think all of the lutex platforms support pthread_cond_timedwait. It
should be fairly simple to support a :TIMEOUT optional parameter in
CONDITION-WAIT.
To address the issue, are there any major concerns with the following
approach?
Index: src/code/target-thread.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/target-thread.lisp,v
retrieving revision 1.93
diff -r1.93 target-thread.lisp
393,398c393,399
< (progn
< ;; FIXME: This doesn't look interrupt safe!
< (setf (mutex-%owner mutex) nil)
< (with-lutex-address (queue-lutex-address (waitqueue-lutex
queue))
< (with-lutex-address (mutex-lutex-address (mutex-lutex mutex))
< (%lutex-wait queue-lutex-address mutex-lutex-address)))
---
> (unwind-protect
> (progn
> (setf (mutex-%owner mutex) nil)
> (with-lutex-address (queue-lutex-address (waitqueue-lutex queue))
> (with-lutex-address (mutex-lutex-address (mutex-lutex mutex))
> (%lutex-wait queue-lutex-address mutex-lutex-address))))
> ;; restore the owner of the mutex if we are interrupted
Regards,
- Scott Bell