[-] Remove experiment that was accidently left in Entrypoint.cpp

This commit is contained in:
Reece Wilson 2021-11-05 17:40:06 +00:00
parent 99c5e1fa65
commit 320d6b95ce
4 changed files with 23 additions and 97 deletions

View File

@ -115,4 +115,24 @@ namespace Aurora::Async
{ {
return NewWork<Info_t, Result_t, Task_t, Job_t>(worker, TaskFromVoidVoid<Info_t, Result_t>(task), job, inputParameters, enableWait); return NewWork<Info_t, Result_t, Task_t, Job_t>(worker, TaskFromVoidVoid<Info_t, Result_t>(task), job, inputParameters, enableWait);
} }
template<typename ReturnValue_t = void, typename ... Args, class Clazz_t, class FunctorTask_t, class FuckYou_t >
static AuSPtr<IWorkItem> DispathSmartWork(const WorkerId_t &worker, AuSPtr<Clazz_t> owner, FunctorTask_t task, FuckYou_t job, Args ... in)
{
return DispatchWork<std::tuple<AuSPtr<Clazz_t>, Args...>, ReturnValue_t>(worker,
TaskFromTupleCallableWithBindOwner2<FTask<std::tuple<AuSPtr<Clazz_t>, Args...>, ReturnValue_t>, ReturnValue_t, FunctorTask_t>(task),
Async::JobFromTupleClazz<ReturnValue_t, AuSPtr<Clazz_t>, Args...>(job),
std::make_tuple<AuSPtr<Clazz_t>, Args...>(AU_FWD(owner), std::forward<Args>(in)...),
false);
}
template<typename ReturnValue_t = void, typename ... Args, class Clazz_t, class FunctorTask_t, class FuckYou_t, class FuckYou2_t >
static AuSPtr<IWorkItem> DispathSmartWorkEx(const WorkerId_t &worker, AuSPtr<Clazz_t> owner, FunctorTask_t task, FuckYou_t success, FuckYou2_t failure, Args ... in)
{
return DispatchWork<std::tuple<AuSPtr<Clazz_t>, Args...>, ReturnValue_t>(worker,
TaskFromTupleCallableWithBindOwner2<FTask<std::tuple<AuSPtr<Clazz_t>, Args...>, ReturnValue_t>, ReturnValue_t, FunctorTask_t>(task),
Async::JobFromTupleClazzEx<ReturnValue_t, AuSPtr<Clazz_t>, Args...>(success, failure),
std::make_tuple<AuSPtr<Clazz_t>, Args...>(AU_FWD(owner), std::forward<Args>(in)...),
false);
}
} }

View File

@ -20,22 +20,8 @@ namespace Aurora::Async
AUKN_SYM WorkerPId_t GetCurrentWorkerPId() AUKN_SYM WorkerPId_t GetCurrentWorkerPId()
{ {
auto lkPool = gCurrentPool.lock(); auto lkPool = gCurrentPool.lock();
if (!lkPool)
{
LogWarn("s..");
return {};
}
auto cpy = *lkPool->tlsWorkerId; auto cpy = *lkPool->tlsWorkerId;
auto lkPool2 = cpy.pool.lock(); auto lkPool2 = cpy.pool.lock();
if (!lkPool2)
{
LogWarn("..");
return {};
}
if (lkPool2 != lkPool){
LogWarn(".r.");
return {};
}
return WorkerPId_t(lkPool, cpy); return WorkerPId_t(lkPool, cpy);
} }
@ -263,9 +249,11 @@ namespace Aurora::Async
{ {
AU_LOCK_GUARD(group->cvWorkMutex); AU_LOCK_GUARD(group->cvWorkMutex);
// TODO: reimplement this
// this is stupid and gross
if (group->workQueue.size() > 2) if (group->workQueue.size() > 2)
{ {
if (!group->sorted && false) if (!group->sorted)
{ {
auto cpy = group->workQueue; auto cpy = group->workQueue;

View File

@ -28,28 +28,18 @@ namespace Aurora::Async
struct ThreadState struct ThreadState
{ {
WorkerId_t id; WorkerId_t id;
//bool eventDriven {};
AuUInt8 multipopCount = 1; AuUInt8 multipopCount = 1;
AuUInt32 lastFrameTime {}; AuUInt32 lastFrameTime {};
AuThreads::ThreadShared_t threadObject; AuThreads::ThreadShared_t threadObject;
//std::stack<jmp_buf> jmpStack;
AuWPtr<GroupState> parent; AuWPtr<GroupState> parent;
AuThreadPrimitives::SemaphoreUnique_t syncSema; AuThreadPrimitives::SemaphoreUnique_t syncSema;
AuList<AuSPtr<AuThreads::IThreadFeature>> features; AuList<AuSPtr<AuThreads::IThreadFeature>> features;
bool rejecting {}; bool rejecting {};
bool exiting {}; bool exiting {};
bool inLoopSourceMode {}; bool inLoopSourceMode {};
bool shuttingdown {}; bool shuttingdown {};
AuThreadPrimitives::EventUnique_t running; AuThreadPrimitives::EventUnique_t running;
//bool running; //bool running;
AuList<AsyncAppWaitSourceRequest> loopSources; AuList<AsyncAppWaitSourceRequest> loopSources;
AuList<WorkEntry_t> pendingWorkItems; AuList<WorkEntry_t> pendingWorkItems;
}; };

View File

@ -55,82 +55,10 @@ static void Deinit()
Aurora::Processes::Deinit(); Aurora::Processes::Deinit();
} }
namespace Aurora::Async
{
template<typename ReturnValue_t = void, typename ... Args, class Clazz_t, class FunctorTask_t, class FuckYou_t >
static AuSPtr<IWorkItem> DispathSmartWork(const WorkerId_t &worker, AuSPtr<Clazz_t> owner, FunctorTask_t task, FuckYou_t job, Args ... in)
{
return DispatchWork<std::tuple<AuSPtr<Clazz_t>, Args...>, ReturnValue_t>(worker,
TaskFromTupleCallableWithBindOwner2<FTask<std::tuple<AuSPtr<Clazz_t>, Args...>, ReturnValue_t>, ReturnValue_t, FunctorTask_t>(task),
Async::JobFromTupleClazz<ReturnValue_t, AuSPtr<Clazz_t>, Args...>(job),
std::make_tuple<AuSPtr<Clazz_t>, Args...>(AU_FWD(owner), std::forward<Args>(in)...),
false);
}
template<typename ReturnValue_t = void, typename ... Args, class Clazz_t, class FunctorTask_t, class FuckYou_t, class FuckYou2_t >
static AuSPtr<IWorkItem> DispathSmartWorkEx(const WorkerId_t &worker, AuSPtr<Clazz_t> owner, FunctorTask_t task, FuckYou_t success, FuckYou2_t failure, Args ... in)
{
return DispatchWork<std::tuple<AuSPtr<Clazz_t>, Args...>, ReturnValue_t>(worker,
TaskFromTupleCallableWithBindOwner2<FTask<std::tuple<AuSPtr<Clazz_t>, Args...>, ReturnValue_t>, ReturnValue_t, FunctorTask_t>(task),
Async::JobFromTupleClazzEx<ReturnValue_t, AuSPtr<Clazz_t>, Args...>(success, failure),
std::make_tuple<AuSPtr<Clazz_t>, Args...>(AU_FWD(owner), std::forward<Args>(in)...),
false);
}
}
namespace Aurora namespace Aurora
{ {
static bool gRuntimeHasStarted {}; static bool gRuntimeHasStarted {};
struct A : std::enable_shared_from_this<A>
{
AuUInt64 DoWork(AuUInt64 in, AuUInt64 in2)
{
return in * 2 * in2;
}
void DoWorkComplete(const AuSPtr<A> &worker, const AuUInt64 &out)
{
AuLog::LogVerbose("Math calculation finished on a remote thread, result: {}", out);
}
static void DoWorkFail(const AuSPtr<A> &worker)
{
SysPanic("How did I fail?");
}
void DoWorkComplete2(const AuUInt64 &a, const AuUInt64 &b, const AuUInt64 &c)
{
AuLog::LogVerbose("Math calculation finished on a remote thread, result: {} * 2 * {} = {}", a, b, c);
}
void DoWorkFail2(AuUInt64 a, AuUInt64 b)
{
SysPanic("How did I fail?");
}
void RunAsyncMath(AuUInt64 in, AuUInt64 in2)
{
Async::DispathSmartWorkEx<AuUInt64, AuUInt64, AuUInt64>(AuWorkerId_t {},
AuSharedFromThis(),
std::bind(&A::DoWork, AuSharedFromThis(), std::placeholders::_1, std::placeholders::_2),
std::bind<void>(&A::DoWorkComplete, AuSharedFromThis(), std::placeholders::_1, std::placeholders::_2),
std::bind<void>(DoWorkFail, std::placeholders::_1),
in,
in2);
Async::DispatchWork<std::tuple<AuUInt64, AuUInt64>,AuUInt64>(AuWorkerId_t {},
AuAsync::TaskFromTupleCallable<AuUInt64, AuUInt64, AuUInt64>(std::bind(&A::DoWork, AuSharedFromThis(), std::placeholders::_1, std::placeholders::_2)),
AuAsync::JobFromTupleConsumerEx<AuUInt64, AuUInt64, AuUInt64>(
std::bind<void>(&A::DoWorkComplete2, AuSharedFromThis(), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3),
std::bind<void>(&A::DoWorkFail2, AuSharedFromThis(), std::placeholders::_1, std::placeholders::_2)),
std::make_tuple(in, in2));
}
};
AUKN_SYM void RuntimeStart(const RuntimeStartInfo &info) AUKN_SYM void RuntimeStart(const RuntimeStartInfo &info)
{ {
gRuntimeConfig = info; gRuntimeConfig = info;