AuroraRuntime/Source/Threading/Threads/AuThreads.cpp

38 lines
787 B
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuThreads.cpp
Date: 2021-6-21
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "AuThreads.hpp"
#include "AuOSThread.hpp"
namespace Aurora::Threading::Threads
{
AUKN_SYM IAuroraThread *ThreadNew(const ThreadInfo &info)
{
if (!info.callbacks)
{
SysPushErrorArg();
return {};
}
return _new OSThread(info);
}
AUKN_SYM void ThreadRelease(IAuroraThread *pThread)
{
AuSafeDelete<OSThread *>(pThread);
}
AUKN_SYM void TerminateCurrent()
{
auto thread = GetThread();
if (thread && gRuntimeRunLevel < 4)
{
thread->Terminate();
}
}
}