diff options
| author | Owen Jacobson <owen.jacobson@grimoire.ca> | 2014-10-27 13:22:40 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen.jacobson@grimoire.ca> | 2014-10-27 13:22:40 -0400 |
| commit | 74fdde9fec6053f1af66e2eabe42c052de2551c3 (patch) | |
| tree | eba83988a0ae7f6513436f46144f59e3f5b00c9b /wiki/dev/shutdown-hooks.md | |
| parent | 9a877d92fe883482153413d265708f547f74fc19 (diff) | |
Added the catch-all case to falsehoods about shutdown hooks. (Thanks, @idcmp!)
Diffstat (limited to 'wiki/dev/shutdown-hooks.md')
| -rw-r--r-- | wiki/dev/shutdown-hooks.md | 2 |
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. |
