3 comments

[ 2.7 ms ] story [ 15.7 ms ] thread
(comment deleted)
The new "plumber" mechanism is useful for things like flushing buffers, doing clean disconnects from network services, committing or rolling-back transactions, and releasing kernel resources.

For example, you might be using a buffered TCP/IP connection to a message broker. Registering a plumber flush callback would let you automatically flush and close the connection before the process exits.

Similarly, the PortAudio library [1] requires you to call Pa_Terminate on pain of possible kernel resource leaks. The plumber mechanism can be used to ensure Pa_Terminate is called before process exit.

[1] http://www.portaudio.com/