|
HydraHook
Direct3D and Core Audio hooking library for Windows
|
Lock-free tracker for in-flight hook lambda invocations. More...
#include <Engine.h>
Classes | |
| struct | Guard |
| RAII guard placed at the top of every hook lambda. More... | |
Static Public Member Functions | |
| static void | shutdown () noexcept |
| Sets the shutdown flag so new Guard instances skip callbacks. | |
| static void | reset () noexcept |
| Clears the shutdown flag so a rehook invokes callbacks again. | |
| static bool | drain (DWORD timeout_ms=5000) noexcept |
| Spin-waits until every in-flight lambda has returned. | |
Static Public Attributes | |
| static std::atomic< int32_t > | s_active {0} |
| static std::atomic< bool > | s_shutting_down {false} |
Lock-free tracker for in-flight hook lambda invocations.
Allows the engine thread to wait for all render-thread callbacks to complete before unloading the DLL. The hot path is two atomic increments/decrements (lock xadd on x86-64) and one flag load – no mutex, no kernel transition.
|
inlinestaticnoexcept |
Spin-waits until every in-flight lambda has returned.
Only called once at shutdown, after all hooks have been removed (so no new entries are possible). Yields the time-slice on each iteration to avoid burning a core.
| timeout_ms | Maximum time to wait. |
Definition at line 226 of file Engine.h.
References s_active.
Referenced by DestroyEngine(), HydraHookEngineRehook(), and HydraHookEngineUnhook().
|
inlinestaticnoexcept |
Clears the shutdown flag so a rehook invokes callbacks again.
Definition at line 211 of file Engine.h.
References s_shutting_down.
Referenced by HydraHookEngineCreate(), and HydraHookEngineRehook().
|
inlinestaticnoexcept |
Sets the shutdown flag so new Guard instances skip callbacks.
Definition at line 205 of file Engine.h.
References s_shutting_down.
Referenced by DestroyEngine().
|
inlinestatic |
Definition at line 175 of file Engine.h.
Referenced by drain(), HookActivityTracker::Guard::Guard(), and HookActivityTracker::Guard::~Guard().
|
inlinestatic |
Definition at line 176 of file Engine.h.
Referenced by HookActivityTracker::Guard::Guard(), reset(), and shutdown().