#include <atomic>
#include <iostream>
#include <thread>
#include <vector>
int main(int argc, char** argv)
{
std::cout << "Press Enter to stop..." << std::endl;
std::bitset<64> affinity1(0x5555555555555555ull);
std::bitset<64> affinity2(0xAAAAAAAAAAAAAAAAull);
std::atomic<bool> stop(false);
std::vector<std::thread> threads;
for (int thread = 0; thread < 8; ++thread)
{
{
while (!stop)
{
{
}
}
});
threads.emplace_back(std::move(thrd));
}
std::cin.get();
stop = true;
for (auto& thread : threads)
thread.join();
return 0;
}
Critical section synchronization primitive.
static void SetupProcess()
Setup exceptions handler for the current process.
Locker synchronization primitive.
static void Initialize()
Initialize stack trace manager.
static uint64_t CurrentThreadId() noexcept
Get the current thread Id.
static void Sleep(int64_t milliseconds) noexcept
Sleep the current thread for the given milliseconds.
static uint32_t CurrentThreadAffinity() noexcept
Get the current thread CPU affinity.
static void SetAffinity(const std::bitset< 64 > &affinity)
Set the current thread CPU affinity bitset.
static std::thread Start(Fn &&fn, Args &&... args)
Start a new thread with an exception handler registered.
Critical section synchronization primitive definition.
Exceptions handler definition.
Stack trace manager definition.