Skip to content

Commit df5f5ce

Browse files
authored
Implement get_current_tid_inner for FreeBSD and Illumos (#83)
1 parent 3b96412 commit df5f5ce

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ jobs:
118118
fail-fast: false
119119
matrix:
120120
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
121-
target: ['', 'x86_64-apple-ios']
121+
target: ['', 'x86_64-apple-ios', 'x86_64-unknown-freebsd', 'x86_64-unknown-illumos']
122122
runs-on: ${{ matrix.os }}
123123
steps:
124124
- name: Checkout repository

spdlog/src/record.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,20 @@ fn get_current_tid() -> u64 {
225225
tid as u64
226226
}
227227

228+
#[cfg(target_os = "freebsd")]
229+
#[must_use]
230+
fn get_current_tid_inner() -> u64 {
231+
let tid = unsafe { libc::pthread_getthreadid_np() };
232+
tid as u64
233+
}
234+
235+
#[cfg(target_os = "illumos")]
236+
#[must_use]
237+
fn get_current_tid_inner() -> u64 {
238+
let tid = unsafe { libc::thr_self() };
239+
tid as u64
240+
}
241+
228242
#[cfg(any(target_os = "macos", target_os = "ios"))]
229243
#[must_use]
230244
fn get_current_tid_inner() -> u64 {

0 commit comments

Comments
 (0)