Skip to content

Commit ecc8c2d

Browse files
authored
fix: Run ThreadUtils::setThreadName(...) under jni::ThreadScope (#1200)
1 parent d6c9855 commit ecc8c2d

File tree

1 file changed

+4
-2
lines changed
  • packages/react-native-nitro-modules/android/src/main/cpp/platform

1 file changed

+4
-2
lines changed

packages/react-native-nitro-modules/android/src/main/cpp/platform/ThreadUtils.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ std::string ThreadUtils::getThreadName() {
2525
}
2626

2727
void ThreadUtils::setThreadName(const std::string& name) {
28-
auto jName = jni::make_jstring(name);
29-
JThreadUtils::setCurrentThreadName(jName);
28+
jni::ThreadScope::WithClassLoader([&]() {
29+
auto jName = jni::make_jstring(name);
30+
JThreadUtils::setCurrentThreadName(jName);
31+
});
3032
}
3133

3234
bool ThreadUtils::isUIThread() {

0 commit comments

Comments
 (0)