module; #include #include #include export module Core.Thread; export namespace std { using std::atomic_bool; } export namespace Core { class Mutex final { std::mutex mutex{}; public: void lock() noexcept; void unlock() noexcept; }; class MutexGuard { Mutex& mutex; public: MutexGuard(Mutex& m) noexcept; MutexGuard(const MutexGuard&) = delete; MutexGuard(MutexGuard&&) = delete; ~MutexGuard() noexcept; MutexGuard& operator=(const MutexGuard&) = delete; MutexGuard& operator=(MutexGuard&&) = delete; }; class Thread final { std::thread thread; public: using Function = void (*)(void*); Thread() noexcept; Thread(const Thread& other) = delete; Thread(Thread&& other) noexcept; ~Thread() noexcept; Thread& operator=(const Thread& other) = delete; Thread& operator=(Thread&& other) noexcept; void swap(Thread& other) noexcept; bool start(Function f, void* p) noexcept; bool join() noexcept; }; }