main/utils: Implement ast_get_tid() for NetBSD

Implement the ast_get_tid() function for NetBSD system.  NetBSD supports
getting the TID via _lwp_self().

ASTERISK-29850

Change-Id: If57fd3f9ea15ef5d010bfbdcbbbae9b379f72f8c
This commit is contained in:
Michał Górny 2021-11-11 05:29:44 +01:00 committed by Friendly Automation
parent 7b1e5fa34a
commit c8ef232d76
1 changed files with 4 additions and 0 deletions

View File

@ -36,6 +36,8 @@
#include <unistd.h>
#if defined(__APPLE__)
#include <mach/mach.h>
#elif defined(__NetBSD__)
#include <lwp.h>
#elif defined(HAVE_SYS_THR_H)
#include <sys/thr.h>
#endif
@ -2659,6 +2661,8 @@ int ast_get_tid(void)
long lwpid;
thr_self(&lwpid); /* available since sys/thr.h creation 2003 */
ret = lwpid;
#elif defined(__NetBSD__)
ret = _lwp_self();
#endif
return ret;
}