fix: wait for threads to terminate when shutting down server

This commit is contained in:
Simon Cruanes 2023-08-04 11:01:24 -04:00
parent 5c1530f816
commit 1ca1f3dff9

View file

@ -970,6 +970,9 @@ module Unix_tcp_server_ = struct
k "Unix.accept or Thread.create raised an exception: %s" k "Unix.accept or Thread.create raised an exception: %s"
(Printexc.to_string e)) (Printexc.to_string e))
done; 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 end