Trustin Lee wrote:
First thing I would add would be the unlock for Socket.accept
(something each Acceptor, not only APR should have)
and make sure that Socket.close for the acceptor socket is called even
on the CTRL+C. After all native calls are exited, then you can safely
call the Library.shutdown
Doesn't OS release any resources allocated by a process when the
process quits or dies? Do I really need to call Library.shutdown()?
Am I missing something?
Sure OS will release resources. However APR has set of
internal cleanup callbacks, so when you call Library.terminate or
destroy an Pool, all the object will be gracefully closed
by their corresponding callback.
The hard close might leave temporary files not removed.
Sockets are hard closed instead shutdown thus not
sending FIN packets, etc...
So, it's always better to do it gracefully rather then
depending on the OS.
Regards,
Mladen