Skip to content

Commit e16bbb8

Browse files
committed
iOS/tvOS/watchOS/visionOS: Set the main thread name
Tested in the iOS simulator that the thread name is not set by default, and that setting it improves the debugging experience in lldb / Xcode.
1 parent d8efd5a commit e16bbb8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

std/src/sys/pal/unix/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
6363
args::init(argc, argv);
6464

6565
// Normally, `thread::spawn` will call `Thread::set_name` but since this thread
66-
// already exists, we have to call it ourselves. We only do this on macos
66+
// already exists, we have to call it ourselves. We only do this on Apple targets
6767
// because some unix-like operating systems such as Linux share process-id and
6868
// thread-id for the main thread and so renaming the main thread will rename the
6969
// process and we only want to enable this on platforms we've tested.
70-
if cfg!(target_os = "macos") {
70+
if cfg!(target_vendor = "apple") {
7171
thread::Thread::set_name(&c"main");
7272
}
7373

0 commit comments

Comments
 (0)