Files
NP_Midterm/impl/Utils/Thread.cpp
2025-04-30 12:01:37 +09:00

30 lines
426 B
C++

#include "Utils/Thread.hpp"
namespace Chattr {
Thread::Thread(Thread&& other) noexcept {
other.detach();
}
Thread& Thread::operator=(Thread&& other) noexcept {
other.detach();
return *this;
}
Thread::~Thread() {
if (!detached) {
spdlog::critical("There is not joined thread");
std::exit(EXIT_FAILURE);
}
if (returnValuePtr != nullptr)
delete returnValuePtr;
}
void Thread::detach() {
detached = true;
}
}