24 lines
279 B
C++
24 lines
279 B
C++
#include "Utils/Thread.hpp"
|
|
|
|
namespace Chattr {
|
|
Thread::~Thread() {
|
|
if (!detached)
|
|
join();
|
|
}
|
|
|
|
void Thread::join() {
|
|
#ifdef _WIN32
|
|
WaitForSingleObject(handle_, INFINITE);
|
|
#elif __linux__
|
|
pthread_join(handle_, NULL);
|
|
#endif
|
|
}
|
|
|
|
void Thread::detach() {
|
|
detached = true;
|
|
}
|
|
|
|
}
|
|
|
|
|