Skip to content

Commit 2fa8bdf

Browse files
committed
Check the result of pthread_kill()
1 parent 7a9d02a commit 2fa8bdf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/org/truffleruby/core/thread/NativeCallInterrupter.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
package org.truffleruby.core.thread;
1111

12+
import com.oracle.truffle.api.CompilerDirectives;
1213
import com.oracle.truffle.api.TruffleSafepoint;
1314
import org.truffleruby.signal.LibRubySignal;
1415

@@ -58,7 +59,11 @@ static class Task extends TimerTask {
5859
public void run() {
5960
if (executed < MAX_EXECUTIONS) {
6061
executed++;
61-
LibRubySignal.sendSIGVTALRMToThread(threadID);
62+
int result = LibRubySignal.sendSIGVTALRMToThread(threadID);
63+
if (result != 0) {
64+
throw CompilerDirectives.shouldNotReachHere(
65+
String.format("pthread_kill(%x, SIGVTALRM) failed with result=%d", threadID, result));
66+
}
6267
} else {
6368
cancel();
6469
}

0 commit comments

Comments
 (0)