gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r37687 - in libmicrohttpd: . src/include src/microhttpd


From: gnunet
Subject: [GNUnet-SVN] r37687 - in libmicrohttpd: . src/include src/microhttpd
Date: Wed, 10 Aug 2016 15:52:47 +0200

Author: Karlson2k
Date: 2016-08-10 15:52:47 +0200 (Wed, 10 Aug 2016)
New Revision: 37687

Modified:
   libmicrohttpd/configure.ac
   libmicrohttpd/src/include/microhttpd.h
   libmicrohttpd/src/microhttpd/daemon.c
Log:
configure.ac: added --disable-thread-names parameter

Modified: libmicrohttpd/configure.ac
===================================================================
--- libmicrohttpd/configure.ac  2016-08-10 13:52:43 UTC (rev 37686)
+++ libmicrohttpd/configure.ac  2016-08-10 13:52:47 UTC (rev 37687)
@@ -302,7 +302,11 @@
 AM_CONDITIONAL([USE_W32_THREADS], [test "x$USE_THREADS" = "xw32"])
 AC_MSG_RESULT([[$USE_THREADS]])
 
-if test "x$HAVE_POSIX_THREADS" = "xyes"; then
+AC_ARG_ENABLE([[thread-names]],
+   [AS_HELP_STRING([--disable-thread-names [auto] ],[do not set names on MHD 
generated threads])],
+   [], [enable_thread_names='auto'])
+
+if test "x$enable_thread_names" != "xno" && test "x$USE_THREADS" = "xposix"; 
then
   # Check for pthread_setname_np()
   SAVE_LIBS="$LIBS"
   SAVE_CFLAGS="$CFLAGS"
@@ -362,7 +366,43 @@
   CFLAGS="$SAVE_CFLAGS"
 fi
 
+AS_IF(
+  [[test "x$enable_thread_names" != "xno"]],
+  [
+    AC_MSG_CHECKING([[whether to enable thread names]])
+    AC_COMPILE_IFELSE(
+     [AC_LANG_PROGRAM([], [[
+#ifdef MHD_NO_THREAD_NAMES
+#error Thread names are disabled.
+choke me
+#endif
 
+/* Keep in sync with mhd_threads.h */
+#if defined(MHD_USE_POSIX_THREADS) && (defined(HAVE_PTHREAD_SETNAME_NP_GNU) || 
defined(HAVE_PTHREAD_SET_NAME_NP_FREEBSD) || 
defined(HAVE_PTHREAD_SETNAME_NP_DARWIN) || 
defined(HAVE_PTHREAD_SETNAME_NP_NETBSD) )
+int a = 1;
+#elif defined(MHD_USE_W32_THREADS) && defined(_MSC_FULL_VER)
+int b = 2;
+#else
+#error No thread name function is available.
+choke me
+#endif
+       ]])
+     ], [
+       enable_thread_names='yes'
+     ], [
+       AS_IF([[test "x$enable_thread_names" = "xyes"]],
+         [
+           AC_MSG_RESULT([[no]])
+           AC_MSG_ERROR([[thread names was explicitly requested, but thread 
name function is not available]])
+         ])
+       enable_thread_names='no'
+     ])
+  AC_MSG_RESULT([[$enable_thread_names]])
+  ])
+
+AS_IF([[test "x$enable_thread_names" = "xno"]],
+  [AC_DEFINE([[MHD_NO_THREAD_NAMES]], [[1]], [Define to 1 to disable setting 
name on generated threads])])
+
 AM_CONDITIONAL(HAVE_W32, [test "x$os_is_native_w32" = "xyes"])
 w32_shared_lib_exp=no
 if test "x$enable_shared" = "xyes" && test "x$os_is_native_w32" = "xyes"; then
@@ -1007,6 +1047,7 @@
   Cross-compiling:   ${cross_compiling}
   Operating System:  ${host_os}
   Threading lib:     ${USE_THREADS}
+  Use thread names:  ${enable_thread_names}
   libcurl (testing): ${MSG_CURL}
   Target directory:  ${prefix}
   Messages:          ${enable_messages}

Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h      2016-08-10 13:52:43 UTC (rev 
37686)
+++ libmicrohttpd/src/include/microhttpd.h      2016-08-10 13:52:47 UTC (rev 
37687)
@@ -21,6 +21,7 @@
  * @file microhttpd.h
  * @brief public interface to libmicrohttpd
  * @author Christian Grothoff
+ * @author Karlson2k (Evgeny Grin)
  * @author Chris GauthierDickey
  *
  * All symbols defined in this header start with MHD.  MHD is a small
@@ -130,7 +131,7 @@
  * Current version of the library.
  * 0x01093001 = 1.9.30-1.
  */
-#define MHD_VERSION 0x00095002
+#define MHD_VERSION 0x00095003
 
 /**
  * MHD-internal return code for "YES".
@@ -2817,7 +2818,12 @@
    * offsets larger than 2 GiB. If not supported value of size+offset is
    * limited to 2 GiB.
    */
-  MHD_FEATURE_LARGE_FILE = 15
+  MHD_FEATURE_LARGE_FILE = 15,
+
+  /**
+   * Get whether MHD set names on generated threads.
+   */
+  MHD_THREAD_NAMES = 16
 };
 
 

Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c       2016-08-10 13:52:43 UTC (rev 
37686)
+++ libmicrohttpd/src/microhttpd/daemon.c       2016-08-10 13:52:47 UTC (rev 
37687)
@@ -4905,6 +4905,12 @@
 #else
       return (sizeof(uint64_t) > sizeof(off_t)) ? MHD_NO : MHD_YES;
 #endif
+    case MHD_THREAD_NAMES:
+#if defined(MHD_USE_THREAD_NAME_)
+      return MHD_YES;
+#else
+      return MHD_NO;
+#endif
     }
   return MHD_NO;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]