[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] GNU libmicrohttpd branch master updated. 79
From: |
gitolite |
Subject: |
[GNUnet-SVN] [libmicrohttpd] GNU libmicrohttpd branch master updated. 79309bb6026706229fcb651db8b8b37f4ed12885 |
Date: |
Mon, 17 Oct 2016 15:37:19 +0200 (CEST) |
The branch, master has been updated
via 79309bb6026706229fcb651db8b8b37f4ed12885 (commit)
from 71f2285bff70ac45ecf846de203016322997f995 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 79309bb6026706229fcb651db8b8b37f4ed12885
Author: Christian Grothoff <address@hidden>
Date: Mon Oct 17 15:37:16 2016 +0200
removing dead semaphore logic
-----------------------------------------------------------------------
Summary of changes:
src/microhttpd/Makefile.am | 2 +-
src/microhttpd/internal.h | 8 ---
src/microhttpd/mhd_locks.h | 44 +--------------
src/microhttpd/mhd_sem.c | 138 ---------------------------------------------
src/microhttpd/response.c | 21 -------
5 files changed, 2 insertions(+), 211 deletions(-)
delete mode 100644 src/microhttpd/mhd_sem.c
diff --git a/src/microhttpd/Makefile.am b/src/microhttpd/Makefile.am
index 1103073..5984682 100644
--- a/src/microhttpd/Makefile.am
+++ b/src/microhttpd/Makefile.am
@@ -65,7 +65,7 @@ libmicrohttpd_la_SOURCES = \
sysfdsetsize.c sysfdsetsize.h \
mhd_str.c mhd_str.h \
mhd_threads.c mhd_threads.h \
- mhd_locks.h mhd_sem.c \
+ mhd_locks.h \
mhd_sockets.c mhd_sockets.h \
mhd_itc.c mhd_itc.h mhd_itc_types.h \
mhd_compat.h \
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index a7d3a29..89516d8 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -889,14 +889,6 @@ struct MHD_Connection
*/
struct MHD_UpgradeResponseHandle *urh;
- /**
- * If this connection was upgraded and if we are using
- * #MHD_USE_THREAD_PER_CONNECTION without encryption,
- * this points to the semaphore we use to signal termination
- * to the thread handling the connection.
- */
- struct MHD_Semaphore *upgrade_sem;
-
#if HTTPS_SUPPORT
/**
diff --git a/src/microhttpd/mhd_locks.h b/src/microhttpd/mhd_locks.h
index a3fad89..4f2c17e 100644
--- a/src/microhttpd/mhd_locks.h
+++ b/src/microhttpd/mhd_locks.h
@@ -24,7 +24,7 @@
* @author Karlson2k (Evgeny Grin)
* @author Christian Grothoff
*
- * Provides basic abstraction for locks/mutex and semaphores.
+ * Provides basic abstraction for locks/mutex.
* Any functions can be implemented as macro on some platforms
* unless explicitly marked otherwise.
* Any function argument can be skipped in macro, so avoid
@@ -170,47 +170,5 @@
MHD_PANIC(_("Failed to unlock mutex.\n")); \
} while(0)
-/**
- * A semaphore.
- */
-struct MHD_Semaphore;
-
-
-/**
- * Create a semaphore with an initial counter of @a init
- *
- * @param init initial counter
- * @return the semaphore, NULL on error
- */
-struct MHD_Semaphore *
-MHD_semaphore_create (unsigned int init);
-
-
-/**
- * Count down the semaphore, block if necessary.
- *
- * @param sem semaphore to count down.
- */
-void
-MHD_semaphore_down (struct MHD_Semaphore *sem);
-
-
-/**
- * Increment the semaphore.
- *
- * @param sem semaphore to increment.
- */
-void
-MHD_semaphore_up (struct MHD_Semaphore *sem);
-
-
-/**
- * Destroys the semaphore.
- *
- * @param sem semaphore to destroy.
- */
-void
-MHD_semaphore_destroy (struct MHD_Semaphore *sem);
-
#endif /* ! MHD_LOCKS_H */
diff --git a/src/microhttpd/mhd_sem.c b/src/microhttpd/mhd_sem.c
deleted file mode 100644
index 724d6c4..0000000
--- a/src/microhttpd/mhd_sem.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- This file is part of libmicrohttpd
- Copyright (C) 2016 Christian Grothoff
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-
-*/
-
-/**
- * @file microhttpd/mhd_sem.c
- * @brief implementation of semaphores
- * @author Christian Grothoff
- */
-#include "internal.h"
-#include "mhd_locks.h"
-
-/**
- * A semaphore.
- */
-struct MHD_Semaphore
-{
- /**
- * Mutex we use internally.
- */
- pthread_mutex_t mutex;
-
- /**
- * Condition variable used to implement the semaphore.
- */
- pthread_cond_t cv;
-
- /**
- * Current value of the semaphore.
- */
- unsigned int counter;
-};
-
-
-/**
- * Create a semaphore with an initial counter of @a init
- *
- * @param init initial counter
- * @return the semaphore, NULL on error
- */
-struct MHD_Semaphore *
-MHD_semaphore_create (unsigned int init)
-{
- struct MHD_Semaphore *sem;
-
- sem = malloc (sizeof (struct MHD_Semaphore));
- if (NULL == sem)
- return NULL;
- sem->counter = init;
- if (0 != pthread_mutex_init (&sem->mutex,
- NULL))
- {
- free (sem);
- return NULL;
- }
- if (0 != pthread_cond_init (&sem->cv,
- NULL))
- {
- (void) pthread_mutex_destroy (&sem->mutex);
- free (sem);
- return NULL;
- }
- return sem;
-}
-
-
-/**
- * Count down the semaphore, block if necessary.
- *
- * @param sem semaphore to count down.
- */
-void
-MHD_semaphore_down (struct MHD_Semaphore *sem)
-{
- if (0 != pthread_mutex_lock (&sem->mutex))
- MHD_PANIC (_("Failed to lock mutex\n"));
- while (0 == sem->counter)
- {
- if (0 != pthread_cond_wait (&sem->cv,
- &sem->mutex))
- MHD_PANIC (_("pthread_cond_wait failed\n"));
- }
- sem->counter--;
- if (0 != pthread_mutex_unlock (&sem->mutex))
- MHD_PANIC (_("Failed to unlock mutex\n"));
-}
-
-
-/**
- * Increment the semaphore.
- *
- * @param sem semaphore to increment.
- */
-void
-MHD_semaphore_up (struct MHD_Semaphore *sem)
-{
- if (0 != pthread_mutex_lock (&sem->mutex))
- MHD_PANIC (_("Failed to lock mutex\n"));
- sem->counter++;
- pthread_cond_signal (&sem->cv);
- if (0 != pthread_mutex_unlock (&sem->mutex))
- MHD_PANIC (_("Failed to unlock mutex\n"));
-}
-
-
-/**
- * Destroys the semaphore.
- *
- * @param sem semaphore to destroy.
- */
-void
-MHD_semaphore_destroy (struct MHD_Semaphore *sem)
-{
- if (0 != pthread_cond_destroy (&sem->cv))
- MHD_PANIC (_("pthread_cond_destroy failed\n"));
- if (0 != pthread_mutex_destroy (&sem->mutex))
- MHD_PANIC (_("Failed to destroy mutex\n"));
- free (sem);
-}
-
-
-/* end of mhd_sem.c */
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index f774907..d0c7223 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -785,12 +785,6 @@ MHD_response_execute_upgrade_ (struct MHD_Response
*response,
urh->mhd.celi = MHD_EPOLL_STATE_UNREADY;
pool = connection->pool;
avail = MHD_pool_get_free (pool);
- if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION) )
- {
- /* Need to give the thread something to block on... */
- connection->upgrade_sem = MHD_semaphore_create (0);
- }
-
if (avail < 8)
{
/* connection's pool is totally at the limit,
@@ -905,22 +899,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response
*response,
#endif
if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION) )
{
- /* Need to give the thread something to block on... */
- connection->upgrade_sem = MHD_semaphore_create (0);
connection->urh = urh;
- if (NULL == connection->upgrade_sem)
- {
-#ifdef HAVE_MESSAGES
- MHD_DLOG (daemon,
- _("Failed to create semaphore for upgrade handling\n"));
-#endif
- MHD_connection_close_ (connection,
- MHD_REQUEST_TERMINATED_WITH_ERROR);
- return MHD_NO;
- }
- /* Our caller will set 'connection->state' to
- MHD_CONNECTION_UPGRADE, thereby triggering the
- main method of the thread to block on the semaphore. */
}
else
{
hooks/post-receive
--
GNU libmicrohttpd
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [libmicrohttpd] GNU libmicrohttpd branch master updated. 79309bb6026706229fcb651db8b8b37f4ed12885,
gitolite <=