]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Enforce support for thread local variables and POSIX threads
authorMaria Matejka <mq@ucw.cz>
Wed, 22 Apr 2020 14:42:20 +0000 (16:42 +0200)
committerMaria Matejka <mq@ucw.cz>
Thu, 30 Apr 2020 15:38:30 +0000 (17:38 +0200)
configure.ac
lib/birdlib.h
lib/timer.c
sysdep/unix/log.c

index eabb3d562e584afa68aea5788a6660bd9193fe83..7ef31fb449417e2ca122af87aee133fa1398cc86 100644 (file)
@@ -36,12 +36,6 @@ AC_ARG_ENABLE([memcheck],
   [enable_memcheck=yes]
 )
 
-AC_ARG_ENABLE([pthreads],
-  [AS_HELP_STRING([--enable-pthreads], [enable POSIX threads support @<:@try@:>@])],
-  [],
-  [enable_pthreads=try]
-)
-
 AC_ARG_ENABLE([libssh],
   [AS_HELP_STRING([--enable-libssh], [enable LibSSH support in RPKI @<:@try@:>@])],
   [],
@@ -125,25 +119,20 @@ if test -z "$GCC" ; then
 fi
 
 BIRD_CHECK_THREAD_LOCAL
-if test "$bird_cv_thread_local" = yes ; then
-  AC_DEFINE([HAVE_THREAD_LOCAL], [1], [Define to 1 if _Thread_local is available])
+if test "$bird_cv_thread_local" = no ; then
+  AC_MSG_ERROR([Thread-local storage not available]) 
 fi
 
-if test "$enable_pthreads" != no ; then
-  BIRD_CHECK_PTHREADS
+BIRD_CHECK_PTHREADS
+if test "$bird_cv_lib_pthreads" = no ; then
+  AC_MSG_ERROR([POSIX threads not avalable])
+fi
 
-  if test "$bird_cv_lib_pthreads" = yes ; then
-    AC_DEFINE([USE_PTHREADS], [1], [Define to 1 if pthreads are enabled])
-    CFLAGS="$CFLAGS -pthread"
-    LDFLAGS="$LDFLAGS -pthread"
-    proto_bfd=bfd
-  elif test "$enable_pthreads" = yes ; then
-    AC_MSG_ERROR([POSIX threads not available.])
-  fi
+CFLAGS="$CFLAGS -pthread"
+LDFLAGS="$LDFLAGS -pthread"
 
-  if test "$enable_pthreads" = try ; then
-    enable_pthreads="$bird_cv_lib_pthreads"
-  fi
+if test "$enable_pthreads" = try ; then
+  enable_pthreads="$bird_cv_lib_pthreads"
 fi
 
 # This is assumed to be necessary for proper BIRD build
@@ -304,7 +293,7 @@ if test "$enable_mpls_kernel" != no ; then
   fi
 fi
 
-all_protocols="$proto_bfd babel bgp mrt ospf perf pipe radv rip rpki static"
+all_protocols="bfd babel bgp mrt ospf perf pipe radv rip rpki static"
 
 all_protocols=`echo $all_protocols | sed 's/ /,/g'`
 
index 551d3e52ab7b764afc72e5426923c3ee8997d503..e18107e90d3154b60ae64edcd3c36c5a1c766cfd 100644 (file)
@@ -75,10 +75,6 @@ static inline int u64_cmp(u64 i1, u64 i2)
 #define NONNULL(...) __attribute__((nonnull (__VA_ARGS__)))
 #define USE_RESULT __attribute__((warn_unused_result))
 
-#ifndef HAVE_THREAD_LOCAL
-#define _Thread_local
-#endif
-
 /* Microsecond time */
 
 typedef s64 btime;
index a5abbcc46896b25cd015ca18789c3f7a2b2a3403..34b4425395591086c69a38c47f15b2d57dddf93d 100644 (file)
@@ -39,9 +39,6 @@
 
 struct timeloop main_timeloop;
 
-
-#ifdef USE_PTHREADS
-
 #include <pthread.h>
 
 /* Data accessed and modified from proto/bfd/io.c */
@@ -62,14 +59,6 @@ timeloop_init_current(void)
 
 void wakeup_kick_current(void);
 
-#else
-
-/* Just use main timelooop */
-static inline struct timeloop * timeloop_current(void) { return &main_timeloop; }
-static inline void timeloop_init_current(void) { }
-
-#endif
-
 btime
 current_time(void)
 {
index e24322c601add273c1fd3d62e71f6fbf7807a663..80978802b016cdc46730a222c21c9be4fc37af4a 100644 (file)
@@ -36,8 +36,6 @@ static list *current_log_list;
 static char *current_syslog_name; /* NULL -> syslog closed */
 
 
-#ifdef USE_PTHREADS
-
 #include <pthread.h>
 
 static pthread_mutex_t log_mutex;
@@ -48,15 +46,6 @@ static pthread_t main_thread;
 void main_thread_init(void) { main_thread = pthread_self(); }
 static int main_thread_self(void) { return pthread_equal(pthread_self(), main_thread); }
 
-#else
-
-static inline void log_lock(void) {  }
-static inline void log_unlock(void) {  }
-void main_thread_init(void) { }
-static int main_thread_self(void) { return 1; }
-
-#endif
-
 
 #ifdef HAVE_SYSLOG_H
 #include <sys/syslog.h>