Closed pavlinux closed 11 years ago
In line 22 its prototype is marked as
static void destroy(void) __attribute__((destructor));
So it will run when the program exits (with possibly unclosed fds, which we want to subject to the usual cache-freeing that would take place when closing a file).
With atexit() it could be done? It is not clear.
Quoting atexit(3)
:
Linux notes
Since glibc 2.2.3, atexit() (and on_exit(3)) can be used within a
shared library to establish functions that are called when the shared
library is unloaded.
So I’m guessing this should yield an equal code path. However, for symmetry reasons alone I like the constructor/destructor approach currently taken. So if there are no substantial arguments of one over the other, I’d leave it like it is now.
Function nowhere not used? Reserved?