Skip to content

Commit

Permalink
[Truffle] A couple of minor tidy ups.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Jan 30, 2015
1 parent 3c112fb commit 0b8305a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
Expand Up @@ -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);
}
Expand All @@ -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);
}
});
Expand Down
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0b8305a

Please sign in to comment.