Skip to content

Commit d634acf

Browse files
committed
Handle properly interruption in Java version of LockableObject
It was raising an error instead of just returning as it should.
1 parent 9aebc5e commit d634acf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/com/concurrent_ruby/ext/SynchronizationLibrary.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,15 @@ public IRubyObject nsWait(ThreadContext context, IRubyObject[] args) {
189189
}
190190
}
191191
if (Thread.interrupted()) {
192-
throw runtime.newConcurrencyError("thread interrupted");
192+
// do nothing ns_wait is allowed to wake up spuriously
193+
return this;
193194
}
195+
194196
boolean success = false;
195197
try {
196198
success = context.getThread().wait_timeout(this, timeout);
197199
} catch (InterruptedException ie) {
198-
throw runtime.newConcurrencyError(ie.getLocalizedMessage());
200+
// do nothing ns_wait is allowed to wake up spuriously
199201
} finally {
200202
// An interrupt or timeout may have caused us to miss
201203
// a notify that we consumed, so do another notify in

0 commit comments

Comments
 (0)