Apply clang-format across the whole tree
Run clang-format (the repo's .clang-format: LLVM base, 120 cols, tabs, Allman functions) over every source file so the tree is formatter-clean. Whitespace only -- no behavior change; full x64 + x86 suites pass. Also set SortIncludes: false in .clang-format. Windows include order is load-bearing (windows.h must precede tlhelp32.h / mmreg.h / xinput.h / dinput.h; winsock2.h must precede windows.h), and the default alphabetical sort reorders tlhelp32.h ahead of windows.h -- a build break. Leaving order alone keeps the manual, correct grouping.
This commit is contained in:
@@ -24,8 +24,7 @@
|
||||
|
||||
#include <safetyhook.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace {
|
||||
safetyhook::InlineHook g_hook;
|
||||
|
||||
// A real, relocatable, never-inlined target so SafetyHook steals a genuine prologue.
|
||||
@@ -52,17 +51,27 @@ int main(int argc, char** argv)
|
||||
|
||||
std::atomic<bool> stop{false};
|
||||
std::atomic<long long> calls{0};
|
||||
std::thread c1([&] { volatile int s = 0; while (!stop.load(std::memory_order_relaxed)) s = target_fn(static_cast<int>(calls.fetch_add(1))); (void)s; });
|
||||
std::thread c2([&] { volatile int s = 0; while (!stop.load(std::memory_order_relaxed)) s = target_fn(static_cast<int>(calls.fetch_add(1))); (void)s; });
|
||||
std::thread c1([&] {
|
||||
volatile int s = 0;
|
||||
while (!stop.load(std::memory_order_relaxed))
|
||||
s = target_fn(static_cast<int>(calls.fetch_add(1)));
|
||||
(void)s;
|
||||
});
|
||||
std::thread c2([&] {
|
||||
volatile int s = 0;
|
||||
while (!stop.load(std::memory_order_relaxed))
|
||||
s = target_fn(static_cast<int>(calls.fetch_add(1)));
|
||||
(void)s;
|
||||
});
|
||||
std::thread tog;
|
||||
if (!call_only)
|
||||
{
|
||||
if (!call_only) {
|
||||
tog = std::thread([&] {
|
||||
long long n = 0;
|
||||
while (!stop.load(std::memory_order_relaxed))
|
||||
{
|
||||
if (!g_hook.disable()) {}
|
||||
if (!g_hook.enable()) {}
|
||||
while (!stop.load(std::memory_order_relaxed)) {
|
||||
if (!g_hook.disable()) {
|
||||
}
|
||||
if (!g_hook.enable()) {
|
||||
}
|
||||
++n;
|
||||
}
|
||||
std::printf("toggles=%lld\n", n);
|
||||
@@ -72,7 +81,8 @@ int main(int argc, char** argv)
|
||||
stop.store(true);
|
||||
c1.join();
|
||||
c2.join();
|
||||
if (tog.joinable()) tog.join();
|
||||
if (tog.joinable())
|
||||
tog.join();
|
||||
g_hook = {};
|
||||
std::printf("survived %lld calls (mode=%s)\n", calls.load(), call_only ? "callonly" : "toggle");
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user