// SPDX-FileCopyrightText: Copyright 2026 Gloria Goertz, Mireille Meyer // SPDX-License-Identifier: BSD-2-Clause #include #include #include #include namespace atom { std::thread CreateThread(const std::function& function, const std::string& name) { auto thread = std::thread { function }; pthread_setname_np(thread.native_handle(), name.c_str()); return thread; } bool IsThreadAlive(std::thread& thread) { const int result = pthread_kill(thread.native_handle(), 0); switch (result) { case 0: { return true; } case ESRCH: { return false; } default: { ATOM_PANIC("pthread_kill failed with {}", result); } } } }