main/utils: Simplify the FreeBSD ast_get_tid() handling

FreeBSD has had kernel threads for 20+ years.

(cherry picked from commit ec2c10689f)
This commit is contained in:
Brad Smith
2024-01-27 02:43:50 -05:00
committed by Asterisk Development Team
parent 2ec0b83e5b
commit 30d05081d7
4 changed files with 4 additions and 24 deletions

View File

@@ -36,10 +36,10 @@
#include <unistd.h>
#if defined(__APPLE__)
#include <mach/mach.h>
#elif defined(__FreeBSD__)
#include <sys/thr.h>
#elif defined(__NetBSD__)
#include <lwp.h>
#elif defined(HAVE_SYS_THR_H)
#include <sys/thr.h>
#endif
#include "asterisk/network.h"
@@ -2757,9 +2757,9 @@ int ast_get_tid(void)
#elif defined(__APPLE__)
ret = mach_thread_self();
mach_port_deallocate(mach_task_self(), ret);
#elif defined(__FreeBSD__) && defined(HAVE_SYS_THR_H)
#elif defined(__FreeBSD__)
long lwpid;
thr_self(&lwpid); /* available since sys/thr.h creation 2003 */
thr_self(&lwpid);
ret = lwpid;
#elif defined(__NetBSD__)
ret = _lwp_self();