]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
main/utils: Simplify the FreeBSD ast_get_tid() handling
authorBrad Smith <brad@comstyle.com>
Sat, 27 Jan 2024 07:43:50 +0000 (02:43 -0500)
committerBrad Smith <brad@comstyle.com>
Tue, 30 Jan 2024 19:00:05 +0000 (19:00 +0000)
FreeBSD has had kernel threads for 20+ years.

configure
configure.ac
include/asterisk/autoconfig.h.in
main/utils.c

index 79efcc814fa1b5236c201cc134021f7013c7b233..23581c6b544d6fea479fb8ef48ab7bcc94bcc4e3 100755 (executable)
--- a/configure
+++ b/configure
@@ -18532,20 +18532,6 @@ rm -f core conftest.err conftest.$ac_objext \
 #)
 #fi
 
-# for FreeBSD thr_self
-for ac_header in sys/thr.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "sys/thr.h" "ac_cv_header_sys_thr_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_thr_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_SYS_THR_H 1
-_ACEOF
-
-fi
-
-done
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler sync operations" >&5
 $as_echo_n "checking for compiler sync operations... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
index 5c529790846b4cd4e7720d613c166201d6eabe38..639bcd9df3ed181ef8f9289eef7647b48542dba3 100644 (file)
@@ -1174,9 +1174,6 @@ AC_LINK_IFELSE(
 #)
 #fi
 
-# for FreeBSD thr_self
-AC_CHECK_HEADERS([sys/thr.h])
-
 AC_MSG_CHECKING(for compiler sync operations)
 AC_LINK_IFELSE(
 [AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
index 8bcdd960b869602f64967ca9266abba06838d6df..870b95410d3c0c46ddff0f59ad3eeeae625bcd23 100644 (file)
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
-/* Define to 1 if you have the <sys/thr.h> header file. */
-#undef HAVE_SYS_THR_H
-
 /* Define to 1 if you have the <sys/time.h> header file. */
 #undef HAVE_SYS_TIME_H
 
index 58ba1914f8572cfaa4c62740e55f0ced047ec5b6..b4d79867c9c12762ee9a215d584696f6fa258893 100644 (file)
 #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();