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 b3b99af7ae
commit 6560d4b865
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -971,6 +971,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