[#15359] Timeout::Error — Jeremy Thurgood <jerith@...>

Good day,

41 messages 2008/02/05
[#15366] Re: Timeout::Error — Eric Hodel <drbrain@...7.net> 2008/02/06

On Feb 5, 2008, at 06:20 AM, Jeremy Thurgood wrote:

[#15370] Re: Timeout::Error — Jeremy Thurgood <jerith@...> 2008/02/06

Eric Hodel wrote:

[#15373] Re: Timeout::Error — Nobuyoshi Nakada <nobu@...> 2008/02/06

Hi,

[#15374] Re: Timeout::Error — Jeremy Thurgood <jerith@...> 2008/02/06

Nobuyoshi Nakada wrote:

[#15412] Re: Timeout::Error — Nobuyoshi Nakada <nobu@...> 2008/02/07

Hi,

[#15413] Re: Timeout::Error — Jeremy Thurgood <jerith@...> 2008/02/07

Nobuyoshi Nakada wrote:

[#15414] Re: Timeout::Error — Nobuyoshi Nakada <nobu@...> 2008/02/07

Hi,

[#15360] reopen: can't change access mode from "w+" to "w"? — Sam Ruby <rubys@...>

I ran 'rake test' on test/spec [1], using

16 messages 2008/02/05
[#15369] Re: reopen: can't change access mode from "w+" to "w"? — Nobuyoshi Nakada <nobu@...> 2008/02/06

Hi,

[#15389] STDIN encoding differs from default source file encoding — Dave Thomas <dave@...>

This seems strange:

21 messages 2008/02/06
[#15392] Re: STDIN encoding differs from default source file encoding — Yukihiro Matsumoto <matz@...> 2008/02/06

Hi,

[#15481] very bad character performance on ruby1.9 — "Eric Mahurin" <eric.mahurin@...>

I'd like to bring up the issue of how characters are represented in

16 messages 2008/02/10

[#15528] Test::Unit maintainer — Kouhei Sutou <kou@...>

Hi Nathaniel, Ryan,

22 messages 2008/02/13

[#15551] Proc#curry — ts <decoux@...>

21 messages 2008/02/14
[#15557] Re: [1.9] Proc#curry — David Flanagan <david@...> 2008/02/15

ts wrote:

[#15558] Re: [1.9] Proc#curry — Yukihiro Matsumoto <matz@...> 2008/02/15

Hi,

[#15560] Re: Proc#curry — Trans <transfire@...> 2008/02/15

[#15585] Ruby M17N meeting summary — Martin Duerst <duerst@...>

This is a rough translation of the Japanese meeting summary

19 messages 2008/02/18

[#15596] possible bug in regexp lexing — Ryan Davis <ryand-ruby@...>

current:

17 messages 2008/02/19

[#15678] Re: [ANN] MacRuby — "Rick DeNatale" <rick.denatale@...>

On 2/27/08, Laurent Sansonetti <laurent.sansonetti@gmail.com> wrote:

18 messages 2008/02/28
[#15679] Re: [ANN] MacRuby — "Laurent Sansonetti" <laurent.sansonetti@...> 2008/02/28

On Thu, Feb 28, 2008 at 6:33 AM, Rick DeNatale <rick.denatale@gmail.com> wrote:

[#15680] Re: [ANN] MacRuby — Yukihiro Matsumoto <matz@...> 2008/02/28

Hi,

[#15683] Re: [ANN] MacRuby — "Laurent Sansonetti" <laurent.sansonetti@...> 2008/02/28

On Thu, Feb 28, 2008 at 1:51 PM, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:

Re: Timeout::Error

From: "Rocky Bernstein" <rocky.bernstein@...>
Date: 2008-02-11 18:33:39 UTC
List: ruby-core #15505
I wonder if this isn't made worse by the fact that backtrace and caller
elements are strings. Wouldn't it be better for these to return  some sort
of structure or class for which there is a to_s method defined that gives a
string representation that is compatible with the current string
representation?

On Feb 11, 2008 12:54 PM, MenTaLguY <mental@rydia.net> wrote:

> Is there a way to implement this which doesn't rely on parsing the
> exception
> backtrace?  It's going to be nasty for other Ruby implementations, and
> isn't
> great performance-wise.
>
> -mental
>
> On Sun, 10 Feb 2008 11:42:04 +0900, Nobuyoshi Nakada <nobu@ruby-lang.org>
> wrote:
> > Hi,
> >
> > At Sun, 10 Feb 2008 07:24:43 +0900,
> > Joel VanderWerf wrote in [ruby-core:15458]:
> >> Sorry, I wasn't clear. I'm not disagreeing with you, just suggesting
> >> that timeouts could be sensitive to location on the stack.
> >
> > Agreed your suggestion, even for nested timeouts.
> >
> >
> > @@ -25,6 +25,10 @@
> >  module Timeout
> >    # Raised by Timeout#timeout when the block times out.
> > -  class Error < Interrupt
> > +  class Error < StandardError
> >    end
> > +  class ExitException < ::Exception # :nodoc:
> > +  end
> > +
> > +  CALLER_OFFSET = ((c = caller[0]) && /\A#{Regexp.quote(__FILE__)}:/o
> =~
> > c) ? 1 : 0
> >
> >    # Executes the method's block.  If the block execution terminates
> > before
> > @@ -36,6 +40,7 @@ module Timeout
> >    # into your classes so they have a #timeout method, as well as a
> module
> > method,
> >    # so you can call it directly as Timeout.timeout().
> > -  def timeout(sec, exception = Error)   #:yield: +sec+
> > +  def timeout(sec, klass = nil)   #:yield: +sec+
> >      return yield(sec) if sec == nil or sec.zero?
> > +    exception = klass || Class.new(ExitException)
> >      begin
> >        x = Thread.current
> > @@ -45,4 +50,15 @@ module Timeout
> >        }
> >        return yield(sec)
> > +    rescue exception => e
> > +      rej = /\A#{Regexp.quote(__FILE__)}:#{__LINE__-4}\z/o
> > +      (bt = e.backtrace).reject! {|m| rej =~ m}
> > +      level = -caller(CALLER_OFFSET).size
> > +      while /\A#{Regexp.quote(__FILE__)}:/o =~ bt[level]
> > +        bt.delete_at(level)
> > +        level += 1
> > +      end
> > +      raise if klass            # if exception class is specified, it
> > +                                # would be expected outside.
> > +      raise Error, e.message, e.backtrace
> >      ensure
> >        if y and y.alive?
> > @@ -62,5 +78,5 @@ end
> >  # Defined for backwards compatibility with earlier versions of
> > timeout.rb, see
> >  # Timeout#timeout.
> > -def timeout(n, e = Timeout::Error, &block)
> > +def timeout(n, e = nil, &block)
> >    Timeout::timeout(n, e, &block)
> >  end
> >
> >
> >
>
>
>

In This Thread