Files
dl_old/dl/system/dl_thread.cpp
T

32 lines
472 B
C++

#include "dl_thread.h"
#if DL_PLATFORM == DL_PLATFORM_WIN32
#include <Windows.h>
#endif
namespace dl
{
ThreadManager* g_thread;
#if DL_PLATFORM == DL_PLATFORM_WIN32
void Thread::Terminate()
{
TerminateThread(_t.native_handle(), -1);
_state = 1;
}
#endif
Thread::~Thread()
{
if (_t.joinable())
_t.join();
while (true)
{
if (_state != 0)
break;
std::this_thread::sleep_for(std::chrono::seconds(0));
}
g_thread->_remove_ref(this);
}
}