Amend for new AuroraRuntime version
This commit is contained in:
parent
7a62c089a5
commit
f5497c0f7d
@ -2,13 +2,13 @@
|
||||
|
||||
#include "threading.h"
|
||||
#include <AuroraCommon.hpp>
|
||||
#include <Aurora/Kernel.hpp>
|
||||
#include <AuroraRuntime.hpp>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* in)
|
||||
{
|
||||
*in = Aurora::Threading::ConditionalMutexNew();
|
||||
*in = Aurora::Threading::Primitives::ConditionMutexNew();
|
||||
return *in == nullptr;
|
||||
}
|
||||
|
||||
@ -16,28 +16,28 @@ extern "C"
|
||||
{
|
||||
if (*in)
|
||||
{
|
||||
Aurora::Threading::ConditionalMutexDestroy(reinterpret_cast<Aurora::Threading::IConditionalMutex *>(*in));
|
||||
Aurora::Threading::Primitives::ConditionMutexDestroy(reinterpret_cast<Aurora::Threading::Primitives::IConditionMutex *>(*in));
|
||||
*in = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void ZSTD_pthread_mutex_lock(ZSTD_pthread_mutex_t* in)
|
||||
{
|
||||
auto mutex = reinterpret_cast<Aurora::Threading::IConditionalMutex*>(*in);
|
||||
auto mutex = reinterpret_cast<Aurora::Threading::Primitives::IConditionMutex*>(*in);
|
||||
mutex->Lock();
|
||||
}
|
||||
|
||||
void ZSTD_pthread_mutex_unlock(ZSTD_pthread_mutex_t* in)
|
||||
{
|
||||
auto mutex = reinterpret_cast<Aurora::Threading::IConditionalMutex*>(*in);
|
||||
auto mutex = reinterpret_cast<Aurora::Threading::Primitives::IConditionMutex*>(*in);
|
||||
mutex->Unlock();
|
||||
}
|
||||
|
||||
int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* a, ZSTD_pthread_mutex_t* b)
|
||||
{
|
||||
if (!*b) return 1;
|
||||
auto mutex = reinterpret_cast<Aurora::Threading::IConditionalMutex*>(*b);
|
||||
*a = Aurora::Threading::ConditionalNew(mutex);
|
||||
auto mutex = reinterpret_cast<Aurora::Threading::Primitives::IConditionMutex*>(*b);
|
||||
*a = Aurora::Threading::Primitives::ConditionVariableNew(mutex);
|
||||
return *a == nullptr;
|
||||
}
|
||||
|
||||
@ -45,26 +45,26 @@ extern "C"
|
||||
{
|
||||
if (*a)
|
||||
{
|
||||
Aurora::Threading::ConditionalDestroy(reinterpret_cast<Aurora::Threading::IConditional*>(*a));
|
||||
Aurora::Threading::Primitives::ConditionVariableDestroy(reinterpret_cast<Aurora::Threading::Primitives::IConditionVariable*>(*a));
|
||||
*a = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void ZSTD_pthread_cond_wait(ZSTD_pthread_cond_t* a)
|
||||
{
|
||||
auto cond = reinterpret_cast<Aurora::Threading::IConditional*>(*a);
|
||||
auto cond = reinterpret_cast<Aurora::Threading::Primitives::IConditionVariable*>(*a);
|
||||
cond->WaitForSignal();
|
||||
}
|
||||
|
||||
void ZSTD_pthread_cond_signal(ZSTD_pthread_cond_t* a)
|
||||
{
|
||||
auto cond = reinterpret_cast<Aurora::Threading::IConditional*>(*a);
|
||||
auto cond = reinterpret_cast<Aurora::Threading::Primitives::IConditionVariable*>(*a);
|
||||
cond->Signal();
|
||||
}
|
||||
|
||||
void ZSTD_pthread_cond_broadcast(ZSTD_pthread_cond_t* a)
|
||||
{
|
||||
auto cond = reinterpret_cast<Aurora::Threading::IConditional*>(*a);
|
||||
auto cond = reinterpret_cast<Aurora::Threading::Primitives::IConditionVariable*>(*a);
|
||||
cond->Broadcast();
|
||||
}
|
||||
|
||||
@ -73,13 +73,13 @@ extern "C"
|
||||
{
|
||||
*thread = ZSTD_pthread_t{};
|
||||
|
||||
Aurora::Threading::IUserThreadHandler handler;
|
||||
handler.DoRun = [start_routine, arg](Aurora::Threading::IAuroraThread* thread)
|
||||
Aurora::Threading::Threads::AbstractThreadVectors handler;
|
||||
handler.DoRun = [start_routine, arg](Aurora::Threading::Threads::IAuroraThread* thread)
|
||||
{
|
||||
start_routine(arg);
|
||||
};
|
||||
|
||||
auto handle = Aurora::Threading::NewThread(handler);
|
||||
auto handle = Aurora::Threading::Threads::ThreadNew(handler);
|
||||
if (!handle) return 1;
|
||||
|
||||
handle->Run();
|
||||
@ -92,9 +92,9 @@ extern "C"
|
||||
{
|
||||
if (thread.handle)
|
||||
{
|
||||
auto handle = reinterpret_cast<Aurora::Threading::IAuroraThread*>(thread.handle);
|
||||
auto handle = reinterpret_cast<Aurora::Threading::Threads::IAuroraThread*>(thread.handle);
|
||||
handle->Exit();
|
||||
Aurora::Threading::ExterminateThread(handle);
|
||||
Aurora::Threading::Threads::ThreadDestroy(handle);
|
||||
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user