gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r26236 - in libmicrohttpd: . src/daemon


From: gnunet
Subject: [GNUnet-SVN] r26236 - in libmicrohttpd: . src/daemon
Date: Fri, 1 Mar 2013 01:13:00 +0100

Author: grothoff
Date: 2013-03-01 01:12:59 +0100 (Fri, 01 Mar 2013)
New Revision: 26236

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/src/daemon/daemon.c
Log:
the cleanup mutex struct should not be directly copied and share used
by multiple thread, which cause crash on some platform,
e.g. ios/darwin

Ulion



Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2013-03-01 00:06:58 UTC (rev 26235)
+++ libmicrohttpd/ChangeLog     2013-03-01 00:12:59 UTC (rev 26236)
@@ -1,3 +1,6 @@
+Fri Mar  1 01:11:57 CET 2013
+       Fully initialize cleanup mutex struct for each thread. -Ulion
+
 Wed Feb  6 01:51:52 CET 2013
        Releasing libmicrohttpd 0.9.25. -CG
 

Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c   2013-03-01 00:06:58 UTC (rev 26235)
+++ libmicrohttpd/src/daemon/daemon.c   2013-03-01 00:12:59 UTC (rev 26236)
@@ -2536,6 +2536,16 @@
           if (i < leftover_conns)
             ++d->max_connections;
 
+          /* Must init cleanup connection mutex for each worker */
+          if (0 != pthread_mutex_init (&d->cleanup_connection_mutex, NULL))
+            {
+#if HAVE_MESSAGES
+              MHD_DLOG (daemon,
+                       "MHD failed to initialize cleanup connection mutex for 
thread worker %d\n", i);
+#endif
+              goto thread_failed;
+            }
+
           /* Spawn the worker thread */
           if (0 != (res_thread_create = create_thread (&d->pid, daemon, 
&MHD_select_thread, d)))
             {
@@ -2546,6 +2556,7 @@
 #endif
               /* Free memory for this worker; cleanup below handles
                * all previously-created workers. */
+              pthread_mutex_destroy (&d->cleanup_connection_mutex);
               goto thread_failed;
             }
         }
@@ -2707,6 +2718,7 @@
              MHD_PANIC ("Failed to join a thread\n");
            }
          close_all_connections (&daemon->worker_pool[i]);
+         pthread_mutex_destroy 
(&daemon->worker_pool[i].cleanup_connection_mutex);
        }
       free (daemon->worker_pool);
     }




reply via email to

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