Refactor code once more for yet better thread safety at shutdown.
authorMilian Wolff <mail@milianw.de>
Fri, 12 Dec 2014 23:57:02 +0000 (00:57 +0100)
committerMilian Wolff <mail@milianw.de>
Sat, 13 Dec 2014 00:06:29 +0000 (01:06 +0100)
commit82dbe6f3d2a14ae6b6dfc4de54923afd29b07b7f
tree745443787903f8bf2b47017286b26267712aee4a
parent8a699c03ce971bded0b64b40210e7652b4d66788
Refactor code once more for yet better thread safety at shutdown.

Instead of using flockfile, we use a simple spin lock now. This
is even a bit faster than using flockfile, and does not have any
issues at shutdown, when the file was deleted already.

Also, the spin lock can easily be combined with the check for
when the timer thread should be stopped.

Furthermore, the code is restructured to ensure the thread-unsafe
API is only ever getting called while the lock is held.

To simplify future development, some debug log can now be enabled
which will trace the heaptrack execution.
heaptrack_inject.cpp
heaptrack_preload.cpp
libheaptrack.cpp
libheaptrack.h