Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
53b23080
Commit
53b23080
authored
Sep 20, 2019
by
Jan Beich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement _thread_id() on more Unices
parent
c368500e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
include/spdlog/details/os-inl.h
include/spdlog/details/os-inl.h
+19
-6
No files found.
include/spdlog/details/os-inl.h
View file @
53b23080
...
...
@@ -50,8 +50,17 @@
#ifdef __linux__
#include <sys/syscall.h> //Use gettid() syscall under linux to get thread id
#elif defined(__FreeBSD__)
#include <sys/thr.h> //Use thr_self() syscall under FreeBSD to get thread id
#elif defined(_AIX)
#include <pthread.h> // for pthread_getthreadid_np
#elif defined(__DragonFly__) || defined(__FreeBSD__)
#include <pthread_np.h> // for pthread_getthreadid_np
#elif defined(__NetBSD__)
#include <lwp.h> // for _lwp_self
#elif defined(__sun)
#include <thread.h> // for thr_self
#endif
#endif // unix
...
...
@@ -316,10 +325,14 @@ SPDLOG_INLINE size_t _thread_id() SPDLOG_NOEXCEPT
#define SYS_gettid __NR_gettid
#endif
return
static_cast
<
size_t
>
(
syscall
(
SYS_gettid
));
#elif defined(__FreeBSD__)
long
tid
;
thr_self
(
&
tid
);
return
static_cast
<
size_t
>
(
tid
);
#elif defined(_AIX) || defined(__DragonFly__) || defined(__FreeBSD__)
return
static_cast
<
size_t
>
(
pthread_getthreadid_np
());
#elif defined(__NetBSD__)
return
static_cast
<
size_t
>
(
_lwp_self
());
#elif defined(__OpenBSD__)
return
static_cast
<
size_t
>
(
getthrid
());
#elif defined(__sun)
return
static_cast
<
size_t
>
(
thr_self
());
#elif __APPLE__
uint64_t
tid
;
pthread_threadid_np
(
nullptr
,
&
tid
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment