
On Fri, 2009-12-18 at 11:57 -0800, Peter Seibel wrote:
Well, the use I had for it was I needed to wait on a condition variable with a timeout. I.e. wait until the condition was notified or a certain amount of time had passed. In Allegro there was a direct way of doing that but there wasn't in Bordeaux Threads so I had to roll my own. If Bordeaux Threads wants to provide a way of doing that I'll be happy (at least for now). Though I'm not sure I see that WITH-TIMEOUT deserves to be totally removed--you may need to exercise some care about what you put inside a WITH-TIMEOUT but it seems that it shouldn't be drastically worse than any code that, say, calls a user-provided function (which could also signal a condition at a more or less random time.) Unless you're saying it's hard/impossible to implement safely within the Lisp implementation. That I wouldn't know about.
The problem is that the only general way to implement timeouts is to use alarm(2) which asks the kernel to send SIGALRM after a certain amount of time, and mixing signals and condition variables is very prone to errors - the example given by Martin is a typical case of resource leak caused by asynchronous unwinds -- Stelian Ionescu a.k.a. fe[nl]ix Quidquid latine dictum sit, altum videtur. http://common-lisp.net/project/iolib