Skip to content
Permalink
Browse files

Move timeout into a native library; passes all specs, tests I could f…

…ind.
  • Loading branch information...
headius committed Apr 25, 2009
1 parent 8a6baf6 commit ca771648f6a448260b15d68deaff89bd237acad8
Showing with 231 additions and 230 deletions.
  1. +0 −122 lib/ruby/1.8/timeout.rb
  2. +0 −108 lib/ruby/1.9/timeout.rb
  3. +1 −0 spec/jruby.1.8.mspec
  4. +1 −0 src/org/jruby/Ruby.java
  5. +15 −0 src/org/jruby/RubyThread.java
  6. +214 −0 src/org/jruby/ext/Timeout.java

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
@@ -57,6 +57,7 @@ class MSpecScript
DIR + '/ruby/library/stringscanner',
DIR + '/ruby/library/tempfile',
DIR + '/ruby/library/time',
DIR + '/ruby/library/timeout',
DIR + '/ruby/library/tmpdir',
DIR + '/ruby/library/uri',
DIR + '/ruby/library/yaml',
@@ -1289,6 +1289,7 @@ private void initBuiltins() {
addLazyBuiltin("io/wait.so", "io/wait", "org.jruby.libraries.IOWaitLibrary");
addLazyBuiltin("etc.so", "etc", "org.jruby.libraries.EtcLibrary");
addLazyBuiltin("weakref.rb", "weakref", "org.jruby.ext.WeakRef$WeakRefLibrary");
addLazyBuiltin("timeout.rb", "timeout", "org.jruby.ext.Timeout");
addLazyBuiltin("socket.so", "socket", "org.jruby.ext.socket.RubySocket$Service");
addLazyBuiltin("rbconfig.rb", "rbconfig", "org.jruby.libraries.RbConfigLibrary");
addLazyBuiltin("jruby/serialization.rb", "serialization", "org.jruby.libraries.JRubySerializationLibrary");
@@ -636,6 +636,21 @@ public IRubyObject raise(IRubyObject[] args, Block block) {
return this;
}

/**
* This is intended to be used to raise exceptions in Ruby threads from non-
* Ruby threads like Timeout's thread.
*
* @param args Same args as for Thread#raise
* @param block Same as for Thread#raise
*/
public void internalRaise(IRubyObject[] args) {
Ruby runtime = getRuntime();

IRubyObject exception = prepareRaiseException(runtime, args, Block.NULL_BLOCK);

receiveMail(new ThreadService.Event(this, this, ThreadService.Event.Type.RAISE, exception));
}

private IRubyObject prepareRaiseException(Ruby runtime, IRubyObject[] args, Block block) {
if(args.length == 0) {
IRubyObject lastException = errorInfo;
Oops, something went wrong.

0 comments on commit ca77164

Please sign in to comment.
You can’t perform that action at this time.