Skip to content

Commit c2d4bc5

Browse files
committed
Clarify main thread detection comments
1 parent 157346e commit c2d4bc5

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

sentry-android-core/src/main/java/io/sentry/android/core/internal/tombstone/TombstoneParser.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,11 @@ private List<SentryThread> createThreads(
115115
exc.setStacktrace(stacktrace);
116116
}
117117

118-
// Android/Linux convention: the pid of the process is the same as the tid of the main thread.
119-
// The main thread is special in that it is the only thread that can create a Looper and thus
120-
// handle messages on the main thread
118+
// thread id always equals the process id,
119+
// so we use it to reliably detect the main thread
121120
if (tombstone.pid == threadEntryValue.id) {
121+
// the OS may provides a (truncated) process name; normalize it
122+
// back to "main" so downstream consumers see a consistent name
122123
thread.setName("main");
123124
thread.setMain(true);
124125
}

0 commit comments

Comments
 (0)