diff --git a/src/Tiny_httpd_server.ml b/src/Tiny_httpd_server.ml index e59fa360..b1d6fcd0 100644 --- a/src/Tiny_httpd_server.ml +++ b/src/Tiny_httpd_server.ml @@ -970,6 +970,9 @@ module Unix_tcp_server_ = struct k "Unix.accept or Thread.create raised an exception: %s" (Printexc.to_string e)) done; + + (* Wait for all threads to be done: this only works if all threads are done. *) + Sem_.acquire self.sem_max_connections.max self.sem_max_connections; ()); } end