Skip to content

Commit

Permalink
Implement get_current_tid_inner for FreeBSD and Illumos (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
SpriteOvO authored Feb 7, 2025
1 parent 3b96412 commit df5f5ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
target: ['', 'x86_64-apple-ios']
target: ['', 'x86_64-apple-ios', 'x86_64-unknown-freebsd', 'x86_64-unknown-illumos']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
Expand Down
14 changes: 14 additions & 0 deletions spdlog/src/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,20 @@ fn get_current_tid() -> u64 {
tid as u64
}

#[cfg(target_os = "freebsd")]
#[must_use]
fn get_current_tid_inner() -> u64 {
let tid = unsafe { libc::pthread_getthreadid_np() };
tid as u64
}

#[cfg(target_os = "illumos")]
#[must_use]
fn get_current_tid_inner() -> u64 {
let tid = unsafe { libc::thr_self() };
tid as u64
}

#[cfg(any(target_os = "macos", target_os = "ios"))]
#[must_use]
fn get_current_tid_inner() -> u64 {
Expand Down

0 comments on commit df5f5ce

Please sign in to comment.