]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
main/utils: Implement ast_get_tid() for NetBSD
authorMichał Górny <mgorny@NetBSD.org>
Thu, 11 Nov 2021 04:29:44 +0000 (05:29 +0100)
committerFriendly Automation <jenkins2@gerrit.asterisk.org>
Wed, 19 Jan 2022 17:39:27 +0000 (11:39 -0600)
Implement the ast_get_tid() function for NetBSD system.  NetBSD supports
getting the TID via _lwp_self().

ASTERISK-29850

Change-Id: If57fd3f9ea15ef5d010bfbdcbbbae9b379f72f8c

main/utils.c

index dc94c994d140748144d77627c9a4c46a4eea9568..29676fafc14d11069954868ff815b0260018e510 100644 (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;
 }