summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Jacobson <owen.jacobson@grimoire.ca>2014-10-27 13:22:40 -0400
committerOwen Jacobson <owen.jacobson@grimoire.ca>2014-10-27 13:22:40 -0400
commit74fdde9fec6053f1af66e2eabe42c052de2551c3 (patch)
treeeba83988a0ae7f6513436f46144f59e3f5b00c9b
parent9a877d92fe883482153413d265708f547f74fc19 (diff)
Added the catch-all case to falsehoods about shutdown hooks. (Thanks, @idcmp!)
-rw-r--r--wiki/dev/shutdown-hooks.md2
1 files changed, 2 insertions, 0 deletions
diff --git a/wiki/dev/shutdown-hooks.md b/wiki/dev/shutdown-hooks.md
index 62b5d76..bf6b304 100644
--- a/wiki/dev/shutdown-hooks.md
+++ b/wiki/dev/shutdown-hooks.md
@@ -24,4 +24,6 @@ The following beliefs are widespread and incorrect:
5. **Your shutdown hook will be the only thing running.** In languages that support “daemon” threads, shutdown hooks may start before daemon threads terminate. In languages with concurrent shutdown hooks, other hooks will be in flight at the same time. On POSIX platforms, signals can still arrive during your shutdown hook. (Did you start any child processes? `SIGCHLD` can still arrive.)
+6. **You need a shutdown hook.** Closing files, terminating threads, and hanging up network connections are all done automatically by the OS as part of process destruction. The behaviour of the final few writes to a file handle aren't completely deterministic (unflushed data can be lost), but that's true even if a shutdown hook tries to close the file.
+
Programs that rely on shutdown hooks for correctness should be treated as de-facto incorrect, much like object finalization in garbage-collected languages.