48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
#include "thread_win32.hpp"
|
|
|
|
using cruft::thread::win32::thread;
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
thread::thread () noexcept
|
|
{ ; }
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
thread::thread (thread &&rhs) noexcept
|
|
{
|
|
std::swap (m_handle, rhs.m_handle);
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
thread&
|
|
thread::operator= (thread &&rhs) noexcept
|
|
{
|
|
std::swap (m_handle, rhs.m_handle);
|
|
return *this;
|
|
}
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
void thread::join ()
|
|
{
|
|
WaitForSingleObject (m_handle, INFINITE);
|
|
}
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
unsigned int thread::hardware_concurrency (void) noexcept
|
|
{
|
|
SYSTEM_INFO res;
|
|
GetNativeSystemInfo (&res);
|
|
return res.dwNumberOfProcessors;
|
|
}
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
void cruft::thread::win32::this_thread::yield (void) noexcept
|
|
{
|
|
Sleep (0);
|
|
}
|