Skip to content

Commit 1e7b5ab

Browse files
Fix for ThreadLookup.matchesThread().
1 parent d843248 commit 1e7b5ab

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/thread/PosixVMThreads.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public ComparableWord getThreadIdentifier() {
141141
@Override
142142
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
143143
public boolean matchesThread(IsolateThread thread, ComparableWord identifier) {
144-
return VMThreads.OSThreadHandleTL.get(thread).notEqual(identifier);
144+
return VMThreads.OSThreadHandleTL.get(thread).equal(identifier);
145145
}
146146
}
147147
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/VMThreads.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,9 @@ public IsolateThread findIsolateThreadForCurrentOSThread(boolean inCrashHandler)
604604
THREAD_MUTEX.lockNoTransitionUnspecifiedOwner();
605605
}
606606
try {
607-
IsolateThread thread;
608-
for (thread = firstThreadUnsafe(); thread.isNonNull() && threadLookup.matchesThread(thread, identifier); thread = nextThread(thread)) {
607+
IsolateThread thread = firstThreadUnsafe();
608+
while (thread.isNonNull() && !threadLookup.matchesThread(thread, identifier)) {
609+
thread = nextThread(thread);
609610
}
610611
return thread;
611612
} finally {
@@ -1046,7 +1047,7 @@ public ComparableWord getThreadIdentifier() {
10461047

10471048
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
10481049
public boolean matchesThread(IsolateThread thread, ComparableWord identifier) {
1049-
return OSThreadIdTL.get(thread).notEqual(identifier);
1050+
return OSThreadIdTL.get(thread).equal(identifier);
10501051
}
10511052
}
10521053
}

0 commit comments

Comments
 (0)