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.
This commit is contained in:
parent
c64889c537
commit
aa606bb246
@ -63,11 +63,11 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
|
|||||||
args::init(argc, argv);
|
args::init(argc, argv);
|
||||||
|
|
||||||
// Normally, `thread::spawn` will call `Thread::set_name` but since this thread
|
// Normally, `thread::spawn` will call `Thread::set_name` but since this thread
|
||||||
// already exists, we have to call it ourselves. We only do this on macos
|
// already exists, we have to call it ourselves. We only do this on Apple targets
|
||||||
// because some unix-like operating systems such as Linux share process-id and
|
// because some unix-like operating systems such as Linux share process-id and
|
||||||
// thread-id for the main thread and so renaming the main thread will rename the
|
// thread-id for the main thread and so renaming the main thread will rename the
|
||||||
// process and we only want to enable this on platforms we've tested.
|
// process and we only want to enable this on platforms we've tested.
|
||||||
if cfg!(target_os = "macos") {
|
if cfg!(target_vendor = "apple") {
|
||||||
thread::Thread::set_name(&c"main");
|
thread::Thread::set_name(&c"main");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user