Skip to content
Permalink
Browse files
[Truffle] A couple of minor tidy ups.
  • Loading branch information
chrisseaton committed Jan 30, 2015
1 parent 3c112fb commit 0b8305ab907e4141e91805eccfa047de66e9a121
Showing with 17 additions and 18 deletions.
  1. +6 −7 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyFiber.java
  2. +11 −11 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyThread.java
@@ -94,13 +94,11 @@ public void run() {
fiberManager.registerFiber(finalFiber);

try {
try {
final Object arg = finalFiber.waitForResume();
final Object result = finalBlock.rootCall(arg);
finalFiber.lastResumedByFiber.resume(finalFiber, result);
} catch (FiberExitException e) {
// Naturally exit the thread on catching this
}
final Object arg = finalFiber.waitForResume();
final Object result = finalBlock.rootCall(arg);
finalFiber.lastResumedByFiber.resume(finalFiber, result);
} catch (FiberExitException e) {
// Naturally exit the thread on catching this
} finally {
fiberManager.unregisterFiber(finalFiber);
}
@@ -119,6 +117,7 @@ public Object waitForResume() {
FiberMessage message = getContext().getThreadManager().runUntilResult(new BlockingActionWithoutGlobalLock<FiberMessage>() {
@Override
public FiberMessage block() throws InterruptedException {
// TODO (CS 30-Jan-15) this timeout isn't ideal - we already handle interrupts for safepoints
return messageQueue.poll(1, TimeUnit.SECONDS);
}
});
@@ -28,17 +28,6 @@
*/
public class RubyThread extends RubyBasicObject {

public Object getValue() {
return value;
}

public RubyException getException() {
return exception;
}

public void shutdown() {
}

private final ThreadManager manager;

private final CountDownLatch finished = new CountDownLatch(1);
@@ -143,6 +132,17 @@ public RubyBasicObject getThreadLocals() {
return threadLocals;
}

public Object getValue() {
return value;
}

public RubyException getException() {
return exception;
}

public void shutdown() {
}

public static class ThreadAllocator implements Allocator {

@Override

0 comments on commit 0b8305a

Please sign in to comment.