commit 88dde2121306c6eb3f68980afd9755d7ce001a5e
parent e25969a86511fa040f8cc144933fb55739e4cc70
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 14 Oct 2009 12:14:14 +0000
From:
Mike Crowe <mac@mcrowe.com>
To:
libmicrohttpd@gnu.org
Date:
Yesterday 16:48:20
I've looked at the fix in SVN. Unfortunately pthread_join returns an
error rather than setting errno. :( This caused me confusion recently
too.
Here's a patch that fixes this. It passed 'make check' modulo the curl
error 66 put failures that seem to happen for me regardless:
Diffstat:
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/AUTHORS b/AUTHORS
@@ -20,7 +20,7 @@ Colin Caughie <c.caughie@indigovision.com>
David Carvalho <andaris@gmail.com>
David Reiss <dreiss@facebook.com>
Mika Raento <mikie@iki.fi>
-
+Mike Crowe <mac@mcrowe.com>
Documentation contributions also came from:
Marco Maggi <marco.maggi-ipsu@poste.it>
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
@@ -763,6 +763,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
struct MHD_Connection *pos;
struct MHD_Connection *prev;
void *unused;
+ int rc;
pos = daemon->connections;
prev = NULL;
@@ -779,11 +780,11 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
if (0 != (pos->daemon->options & MHD_USE_THREAD_PER_CONNECTION))
{
pthread_kill (pos->pid, SIGALRM);
- if (0 != pthread_join (pos->pid, &unused))
+ if (0 != (rc = pthread_join (pos->pid, &unused)))
{
#if HAVE_MESSAGES
MHD_DLOG (daemon, "Failed to join a thread: %s\n",
- STRERROR (errno));
+ STRERROR (rc));
#endif
abort();
}
@@ -1475,6 +1476,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
void *unused;
int fd;
unsigned int i;
+ int rc;
if (daemon == NULL)
return;
@@ -1508,11 +1510,11 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
pthread_kill (daemon->worker_pool[i].pid, SIGALRM);
for (i = 0; i < daemon->worker_pool_size; ++i)
{
- if (0 != pthread_join (daemon->worker_pool[i].pid, &unused))
+ if (0 != (rc = pthread_join (daemon->worker_pool[i].pid, &unused)))
{
#if HAVE_MESSAGES
MHD_DLOG (daemon, "Failed to join a thread: %s\n",
- STRERROR (errno));
+ STRERROR (rc));
#endif
abort();
}
@@ -1525,11 +1527,11 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
&& (0 == daemon->worker_pool_size)))
{
pthread_kill (daemon->pid, SIGALRM);
- if (0 != pthread_join (daemon->pid, &unused))
+ if (0 != (rc = pthread_join (daemon->pid, &unused)))
{
#if HAVE_MESSAGES
MHD_DLOG (daemon, "Failed to join a thread: %s\n",
- STRERROR (errno));
+ STRERROR (rc));
#endif
abort();
}