[Bordeaux-threads-devel] with-timeout abstraction leaks a bit?

Peter Seibel peter at gigamonkeys.com
Fri Dec 18 19:57:33 UTC 2009


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.

-Peter

On Fri, Dec 18, 2009 at 10:48 AM, Martin Simmons <martin at lispworks.com> wrote:
>>>>>> On Fri, 18 Dec 2009 08:34:15 -0800, Peter Seibel said:
>>
>> I was using WITH-TIMEOUT the other day and it seems that it doesn't
>> quite hide the underlying implementation quite enough: on SBCL it
>> signals an SBCL-specific condition when it times out. Thus to handle
>> the timeout you have to either handle that specific condition or
>> something too broad (like CONDITION). Perhaps BT:WITH-TIMEOUT should
>> handle the underlying condition and signal a BT-defined condition so
>> this code can be written portably. I could provide a patch for SBCL
>> (and probably Allegro) if folks think this is a good idea.
>
> I think it would be better to remove WITH-TIMEOUT completely, because it is
> too dangerous to use in production code.  It causes a throw from a random
> point in the program, so there is no way to use it safely with UNWIND-PROTECT
> without extra code to prevent that.
>
> --
> Martin Simmons
> LispWorks Ltd
> http://www.lispworks.com/
>



-- 
Peter Seibel
http://www.codersatwork.com/
http://www.gigamonkeys.com/blog/




More information about the bordeaux-threads-devel mailing list