Browse Source

Print out how much threads have been created (see also issue #50)

bel 10 years ago
parent
commit
254508bf2d
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/civetweb.c

+ 7 - 1
src/civetweb.c

@@ -7306,7 +7306,13 @@ struct mg_context *mg_start(const struct mg_callbacks *callbacks,
             (void) pthread_mutex_lock(&ctx->thread_mutex);
             (void) pthread_mutex_lock(&ctx->thread_mutex);
             ctx->num_threads--;
             ctx->num_threads--;
             (void) pthread_mutex_unlock(&ctx->thread_mutex);
             (void) pthread_mutex_unlock(&ctx->thread_mutex);
-            mg_cry(fc(ctx), "Cannot start worker thread: %ld", (long) ERRNO);
+            if (i>0) {
+                mg_cry(fc(ctx), "Cannot start worker thread %i: error %ld", i+1, (long) ERRNO);
+            } else {
+                mg_cry(fc(ctx), "Cannot create threads: error %ld", (long) ERRNO);
+                free_context(ctx);
+                return NULL;
+            }
             break;
             break;
         }
         }
     }
     }