mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
modules: improve _gettid wrapper
- use meson to check for gettid() function, always use if available - use syscall fallback on linux, if not - restrict thr_self() fallback to *only* FreeBSD - error out if there isn't any gettid impl
This commit is contained in:
parent
a4b8bd6d52
commit
4c166709d0
2 changed files with 9 additions and 2 deletions
|
|
@ -182,12 +182,16 @@ void pw_rtkit_bus_free(struct pw_rtkit_bus *system_bus)
|
|||
|
||||
static pid_t _gettid(void)
|
||||
{
|
||||
#ifndef __FreeBSD__
|
||||
#if defined(HAVE_GETTID)
|
||||
return (pid_t) gettid();
|
||||
#else
|
||||
#elif defined(__linux__)
|
||||
return syscall(SYS_gettid);
|
||||
#elif defined(__FreeBSD__)
|
||||
long pid;
|
||||
thr_self(&pid);
|
||||
return (pid_t)pid;
|
||||
#else
|
||||
#error "No gettid impl"
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue