AuroraRuntime/Source/Threading/Threads/Threads.cpp

33 lines
710 B
C++

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