From 0049e71acc4bcfbcf13389b2ae0287539fd6fea5 Mon Sep 17 00:00:00 2001 From: Sprite Date: Wed, 6 Sep 2023 17:18:30 +0800 Subject: [PATCH] Handle conditional compilation for getting TID on iOS --- spdlog/src/formatter/pattern_formatter/pattern/thread_id.rs | 4 ++-- spdlog/src/record.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spdlog/src/formatter/pattern_formatter/pattern/thread_id.rs b/spdlog/src/formatter/pattern_formatter/pattern/thread_id.rs index e95d50e..8e97507 100644 --- a/spdlog/src/formatter/pattern_formatter/pattern/thread_id.rs +++ b/spdlog/src/formatter/pattern_formatter/pattern/thread_id.rs @@ -12,8 +12,8 @@ use crate::{ /// /// On Linux, this pattern writes the return value of `gettid` to the output. /// -/// On macOS, this pattern writes the return value of `pthread_self` to the -/// output. +/// On macOS and iOS, this pattern writes the return value of +/// `pthread_threadid_np` to the output. /// /// On Windows, this pattern writes the return value of `GetCurrentThreadId` to /// the output. diff --git a/spdlog/src/record.rs b/spdlog/src/record.rs index e86a822..66561e7 100644 --- a/spdlog/src/record.rs +++ b/spdlog/src/record.rs @@ -269,7 +269,7 @@ fn get_current_tid() -> u64 { tid as u64 } - #[cfg(target_os = "macos")] + #[cfg(any(target_os = "macos", target_os = "ios"))] #[must_use] fn get_current_tid_inner() -> u64 { let mut tid = 0;