Skip to content

Commit

Permalink
Showing 3 changed files with 9 additions and 9 deletions.
5 changes: 0 additions & 5 deletions spec/truffle/tags/core/thread/join_tags.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
fails:Thread#join returns the thread when it is finished
fails:Thread#join returns the thread when it is finished when given a timeout
fails:Thread#join returns nil if it is not finished when given a timeout
fails:Thread#join accepts a floating point timeout length
fails:Thread#join raises any exceptions encountered in the thread body
fails:Thread#join returns the dead thread
fails:Thread#join raises any uncaught exception encountered in ensure block
Original file line number Diff line number Diff line change
@@ -156,11 +156,14 @@ public RubyThread join(RubyThread self, UndefinedPlaceholder timeout) {
}

@Specialization
public RubyThread join(RubyThread self, int timeout) {
public Object join(RubyThread self, int timeout) {
notDesignedForCompilation();

self.join(timeout);
return self;
if (self.join(timeout)) {
return self;
} else {
return getContext().getCoreLibrary().getNilObject();
}
}

}
Original file line number Diff line number Diff line change
@@ -136,7 +136,7 @@ public Boolean block() throws InterruptedException {
}
}

public void join(final int timeout) {
public boolean join(final int timeout) {
final boolean joined = getContext().getThreadManager().runOnce(new BlockingActionWithoutGlobalLock<Boolean>() {
@Override
public Boolean block() throws InterruptedException {
@@ -147,6 +147,8 @@ public Boolean block() throws InterruptedException {
if (joined && exception != null) {
throw new RaiseException(exception);
}

return joined;
}

public void interrupt() {

0 comments on commit b56c170

Please sign in to comment.