On 9/18/06, Eric Hodel <drbrain / segment7.net> wrote:
> On Sep 17, 2006, at 1:08 PM, khaines / enigo.com wrote:
>
> > On Mon, 18 Sep 2006, Joel VanderWerf wrote:
> >
> >> I wish I had an easy answer to this problem, but I don't. Are
> >> timeout and ensure inherently incompatible?
> >
> > I don't have an answer, but what if you make your ensure section
> > into a critical section?
> >
> > ensure
> >   Thread.critical = true
> >   # do stuff
> >   Thread.critical = false
> > end
>
> Careful, you may want:
>
> ensure
>    orig_crit = Thread.critical
>    Thread.critical = true
>    # do stuff
>    Thread.critical = orig_crit
> end
>
> If you may already be inside a critical section.
>
> (or require 'thread' use Thread.exclusive)

This still leaves the race problem.  If you can raise an exception
between an ensure and its first instruction, NOTHING can be safe in
the ensure clause.

To solve this problem would require some changes to the language
semantics.  At the very least external exceptions should not be
accepted when inside an ensure clause.  This would require some
interpreter changes and certainly more thougth than what I have given
it.

> --
> Eric Hodel - drbrain / segment7.net - http://blog.segment7.net
> This implementation is HODEL-HASH-9600 compliant
>
> http://trackmap.robotcoop.com
>
>
>
>


-- 
I'm trying to launch the internet; so I open a terminal and go
"percent sign 'Internet'" at the prompt and it doesn't work. What
gives??!! -- random troll