gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] branch master updated (c49871e7 -> dadddb24


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated (c49871e7 -> dadddb24)
Date: Mon, 27 Nov 2017 20:09:12 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from c49871e7 Updated ChangeLog
     new 201a1228 mhd_locks: added ability to statically initialise mutex, if 
supported by mutex library
     new 46727a1b Added automatic initialisation of MHD even if GNU function 
attribute is not supported.
     new cdbb60f5 Update README.
     new dadddb24 ax_append_link_flags.m4: update revision

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ChangeLog                  |  3 +++
 README                     |  8 +++----
 m4/ax_append_link_flags.m4 |  6 +++---
 src/microhttpd/daemon.c    | 53 ++++++++++++++++++++++++++++++++++++++++++----
 src/microhttpd/mhd_locks.h |  9 ++++++++
 5 files changed, 67 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7ab88910..b04c40d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+Mon Nov 27 21:36:00 MSK 2017
+       Updated README. -EG
+
 Mon Nov 27 18:37:00 MSK 2017
        Corrected names in W32 DLL resources.
        Reordered and clarified configure summary message.
diff --git a/README b/README
index 768df2e1..985b357d 100644
--- a/README
+++ b/README
@@ -46,12 +46,10 @@ sockets.  This should work on OS X, Linux and recent BSD 
systems (at
 least).  On other systems that may trigger a SIGPIPE on send/recv, the
 main application should install a signal handler to handle SIGPIPE.
 
-libmicrohttpd should work well on GNU/Linux, BSD, OS X, W32 and z/OS.
+libmicrohttpd should work well on GNU/Linux, W32, FreeBSD, Darwin,
+NetBSD, OpenBSD, Solaris/OpenIndiana, and z/OS.
 Note that HTTPS is not supported on z/OS (yet).  We also have reports
-of users using it on vxWorks. Note that on platforms where the
-compiler does not support the "constructor" attribute, you must call
-"MHD_init" before using any MHD functions and "MHD_fini" after you
-are done using MHD.
+of users using it on vxWorks.
 
 
 Development Status
diff --git a/m4/ax_append_link_flags.m4 b/m4/ax_append_link_flags.m4
index fd70fc72..6f7f1745 100644
--- a/m4/ax_append_link_flags.m4
+++ b/m4/ax_append_link_flags.m4
@@ -1,5 +1,5 @@
 # ===========================================================================
-#   http://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html
+#   https://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html
 # ===========================================================================
 #
 # SYNOPSIS
@@ -39,7 +39,7 @@
 #   Public License for more details.
 #
 #   You should have received a copy of the GNU General Public License along
-#   with this program. If not, see <http://www.gnu.org/licenses/>.
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
 #
 #   As a special exception, the respective Autoconf Macro's copyright owner
 #   gives unlimited permission to copy, distribute and modify the configure
@@ -54,7 +54,7 @@
 #   modified version of the Autoconf Macro, you may extend this special
 #   exception to the GPL to apply to your modified version as well.
 
-#serial 5
+#serial 6
 
 AC_DEFUN([AX_APPEND_LINK_FLAGS],
 [AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 8005c01e..8f3d47b4 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -149,12 +149,19 @@ mhd_panic_std (void *cls,
 /**
  * Handler for fatal errors.
  */
-MHD_PanicCallback mhd_panic;
+MHD_PanicCallback mhd_panic = NULL;
 
 /**
  * Closure argument for #mhd_panic.
  */
-void *mhd_panic_cls;
+void *mhd_panic_cls = NULL;
+
+/**
+ * Globally initialise library.
+ */
+void
+MHD_init(void);
+
 
 #if defined(_WIN32) && ! defined(__CYGWIN__)
 /**
@@ -163,6 +170,40 @@ void *mhd_panic_cls;
 static int mhd_winsock_inited_ = 0;
 #endif
 
+#ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED
+/**
+ * Do nothing - global initialisation is
+ * performed by library constructor.
+ */
+#define MHD_check_global_init_(x) (void)0
+#else  /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */
+/**
+ * Track global initialisation
+ */
+volatile int global_init_count = 0;
+#ifdef MHD_MUTEX_STATIC_DEFN_INIT_
+/**
+ * Global initialisation mutex
+ */
+MHD_MUTEX_STATIC_DEFN_INIT_(global_init_mutex_);
+#endif /* MHD_MUTEX_STATIC_DEFN_INIT_ */
+/**
+ * Check whether global initialisation was performed
+ * and call initialiser if necessary.
+ */
+void
+MHD_check_global_init_ (void)
+{
+#ifdef MHD_MUTEX_STATIC_DEFN_INIT_
+  MHD_mutex_lock_chk_(&global_init_mutex_);
+#endif /* MHD_MUTEX_STATIC_DEFN_INIT_ */
+  if (0 == global_init_count++)
+    MHD_init ();
+#ifdef MHD_MUTEX_STATIC_DEFN_INIT_
+  MHD_mutex_unlock_chk_(&global_init_mutex_);
+#endif /* MHD_MUTEX_STATIC_DEFN_INIT_ */
+}
+#endif /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */
 
 /**
  * Trace up to and return master daemon. If the supplied daemon
@@ -5215,6 +5256,7 @@ MHD_start_daemon_va (unsigned int flags,
   enum MHD_FLAG eflags; /* same type as in MHD_Daemon */
   enum MHD_FLAG *pflags;
 
+  MHD_check_global_init_();
   eflags = (enum MHD_FLAG) flags;
   pflags = &eflags;
 #ifndef HAVE_INET6
@@ -6709,8 +6751,9 @@ MHD_init(void)
 #if defined(_WIN32) && ! defined(__CYGWIN__)
   WSADATA wsd;
 #endif /* _WIN32 && ! __CYGWIN__ */
-  mhd_panic = &mhd_panic_std;
-  mhd_panic_cls = NULL;
+
+  if (NULL == mhd_panic)
+    mhd_panic = &mhd_panic_std;
 
 #if defined(_WIN32) && ! defined(__CYGWIN__)
   if (0 != WSAStartup(MAKEWORD(2, 2), &wsd))
@@ -6759,6 +6802,8 @@ MHD_fini(void)
   MHD_monotonic_sec_counter_finish();
 }
 
+#ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED
 _SET_INIT_AND_DEINIT_FUNCS(MHD_init, MHD_fini);
+#endif /* _AUTOINIT_FUNCS_ARE_SUPPORTED */
 
 /* end of daemon.c */
diff --git a/src/microhttpd/mhd_locks.h b/src/microhttpd/mhd_locks.h
index 4f2c17e5..21db56c4 100644
--- a/src/microhttpd/mhd_locks.h
+++ b/src/microhttpd/mhd_locks.h
@@ -86,6 +86,15 @@
 #endif
 
 #if defined(MHD_PTHREAD_MUTEX_)
+#  if defined(PTHREAD_MUTEX_INITIALIZER)
+/**
+ *  Define static mutex and statically initialise it.
+ */
+#    define MHD_MUTEX_STATIC_DEFN_INIT_(m) static MHD_mutex_ m = 
PTHREAD_MUTEX_INITIALIZER
+#  endif /* PTHREAD_MUTEX_INITIALIZER */
+#endif
+
+#if defined(MHD_PTHREAD_MUTEX_)
 /**
  * Destroy previously initialised mutex.
  * @param pmutex pointer to mutex

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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