[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r10151 - libmicrohttpd/src/daemon
From: |
gnunet |
Subject: |
[GNUnet-SVN] r10151 - libmicrohttpd/src/daemon |
Date: |
Wed, 27 Jan 2010 18:21:48 +0100 |
Author: grothoff
Date: 2010-01-27 18:21:48 +0100 (Wed, 27 Jan 2010)
New Revision: 10151
Modified:
libmicrohttpd/src/daemon/daemon.c
Log:
pthread_create may not always set errno, use return value instead
Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c 2010-01-27 17:16:40 UTC (rev 10150)
+++ libmicrohttpd/src/daemon/daemon.c 2010-01-27 17:21:48 UTC (rev 10151)
@@ -655,7 +655,8 @@
#endif
struct sockaddr *addr = (struct sockaddr *) &addrstorage;
socklen_t addrlen;
- int s, res_thread_create;
+ int s;
+ int res_thread_create;
#if OSX
static int on = 1;
#endif
@@ -827,7 +828,7 @@
{
#if HAVE_MESSAGES
MHD_DLOG (daemon, "Failed to create a thread: %s\n",
- STRERROR (errno));
+ STRERROR (res_thread_create));
#endif
SHUTDOWN (s, SHUT_RDWR);
CLOSE (s);
@@ -1601,15 +1602,15 @@
return NULL;
}
#endif
- if (((0 != (options & MHD_USE_THREAD_PER_CONNECTION)) ||
- ((0 != (options & MHD_USE_SELECT_INTERNALLY))
- && (0 == retVal->worker_pool_size)))
- && (0 !=
- pthread_create (&retVal->pid, NULL, &MHD_select_thread, retVal)))
+ if ( ( (0 != (options & MHD_USE_THREAD_PER_CONNECTION)) ||
+ ( (0 != (options & MHD_USE_SELECT_INTERNALLY)) &&
+ (0 == retVal->worker_pool_size)) ) &&
+ (0 != (res_thread_create =
+ pthread_create (&retVal->pid, NULL, &MHD_select_thread, retVal))))
{
#if HAVE_MESSAGES
MHD_DLOG (retVal,
- "Failed to create listen thread: %s\n", STRERROR (errno));
+ "Failed to create listen thread: %s\n", STRERROR
(res_thread_create));
#endif
pthread_mutex_destroy (&retVal->per_ip_connection_mutex);
free (retVal);
@@ -1682,11 +1683,12 @@
++d->max_connections;
/* Spawn the worker thread */
- if (0 != pthread_create (&d->pid, NULL, &MHD_select_thread, d))
+ if (0 != (res_thread_create = pthread_create (&d->pid, NULL,
&MHD_select_thread, d)))
{
#if HAVE_MESSAGES
MHD_DLOG (retVal,
- "Failed to create pool thread: %s\n", STRERROR
(errno));
+ "Failed to create pool thread: %s\n",
+ STRERROR (res_thread_create));
#endif
/* Free memory for this worker; cleanup below handles
* all previously-created workers. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r10151 - libmicrohttpd/src/daemon,
gnunet <=