Update headers, untabify. I guess the vs extension killed itself
This commit is contained in:
parent
eb4a495199
commit
337062b490
@ -22,33 +22,33 @@ namespace Aurora::Async
|
||||
using WorkerId_t = std::pair<ThreadGroup_t, ThreadId_t>;
|
||||
using DispatchTarget_t = std::pair<ThreadGroup_t, std::optional<ThreadId_t>>;
|
||||
|
||||
struct IWorkItemHandler
|
||||
{
|
||||
enum class EProcessNext
|
||||
{
|
||||
eInvalid = -1,
|
||||
eFinished = 0,
|
||||
eRerun,
|
||||
eSchedule,
|
||||
struct IWorkItemHandler
|
||||
{
|
||||
enum class EProcessNext
|
||||
{
|
||||
eInvalid = -1,
|
||||
eFinished = 0,
|
||||
eRerun,
|
||||
eSchedule,
|
||||
eFailed
|
||||
};
|
||||
};
|
||||
|
||||
struct ProcessInfo
|
||||
{
|
||||
ProcessInfo(bool finished) : type(finished ? EProcessNext::eFinished : EProcessNext::eFailed) {}
|
||||
ProcessInfo(EProcessNext type) : type(type) {}
|
||||
ProcessInfo(const AuList<AuSPtr<IWorkItem>> &blockedBy) : type(EProcessNext::eSchedule), waitFor(blockedBy) {}
|
||||
// ...
|
||||
struct ProcessInfo
|
||||
{
|
||||
ProcessInfo(bool finished) : type(finished ? EProcessNext::eFinished : EProcessNext::eFailed) {}
|
||||
ProcessInfo(EProcessNext type) : type(type) {}
|
||||
ProcessInfo(const AuList<AuSPtr<IWorkItem>> &blockedBy) : type(EProcessNext::eSchedule), waitFor(blockedBy) {}
|
||||
// ...
|
||||
|
||||
EProcessNext type;
|
||||
AuList<AuSPtr<IWorkItem>> waitFor;
|
||||
AuUInt32 reschedMs;
|
||||
//AuUInt64 reschedNs;
|
||||
};
|
||||
EProcessNext type;
|
||||
AuList<AuSPtr<IWorkItem>> waitFor;
|
||||
AuUInt32 reschedMs;
|
||||
//AuUInt64 reschedNs;
|
||||
};
|
||||
|
||||
virtual void DispatchFrame(ProcessInfo &info) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
};
|
||||
virtual void DispatchFrame(ProcessInfo &info) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
};
|
||||
|
||||
|
||||
template<typename Info_t = AVoid, typename Result_t = AVoid>
|
||||
@ -65,7 +65,7 @@ namespace Aurora::Async
|
||||
void(* onFailure)(const Info_t &, bool taskNeverDispatched); // called from caller thread if taskNeverDispatched
|
||||
};
|
||||
|
||||
template<typename Info_t = AVoid, typename Result_t = AVoid>
|
||||
template<typename Info_t = AVoid, typename Result_t = AVoid>
|
||||
struct FTask
|
||||
{
|
||||
std::function<std::optional<Result_t>(const Info_t &)> onFrame = 0;
|
||||
@ -114,19 +114,19 @@ namespace Aurora::Async
|
||||
|
||||
private:
|
||||
|
||||
void DispatchFrame(ProcessInfo &info) override
|
||||
{
|
||||
void DispatchFrame(ProcessInfo &info) override
|
||||
{
|
||||
try
|
||||
{
|
||||
callback();
|
||||
callback();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Debug::PrintError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Shutdown() override
|
||||
void Shutdown() override
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -139,7 +139,7 @@ namespace Aurora::Async
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Info_t, typename Result_t, typename Task_t = FTask<Info_t, Result_t>, typename Job_t = FJob<Info_t, Result_t>>
|
||||
template<typename Info_t, typename Result_t, typename Task_t = FTask<Info_t, Result_t>, typename Job_t = FJob<Info_t, Result_t>>
|
||||
struct BasicWorkCallback : IWorkItemHandler, std::enable_shared_from_this<IWorkItemHandler>
|
||||
{
|
||||
BasicWorkCallback()
|
||||
@ -152,15 +152,15 @@ namespace Aurora::Async
|
||||
|
||||
Info_t input;
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
static constexpr bool IsCallbackPtr = std::is_pointer_v<Job_t> || is_base_of_template<AuSPtr, Job_t>;
|
||||
static constexpr bool IsTaskPtr = std::is_pointer_v<Task_t> || is_base_of_template<AuSPtr, Task_t>;
|
||||
|
||||
WorkerId_t caller;
|
||||
|
||||
void DispatchFrame(ProcessInfo &info) override
|
||||
{
|
||||
void DispatchFrame(ProcessInfo &info) override
|
||||
{
|
||||
std::optional<Result_t> ret;
|
||||
|
||||
if constexpr (IsTaskPtr)
|
||||
@ -237,10 +237,10 @@ namespace Aurora::Async
|
||||
Debug::PrintError();
|
||||
Shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Shutdown() override
|
||||
{
|
||||
void Shutdown() override
|
||||
{
|
||||
try
|
||||
{
|
||||
if constexpr (IsCallbackPtr)
|
||||
@ -256,10 +256,10 @@ namespace Aurora::Async
|
||||
{
|
||||
Debug::PrintError();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Frame_t = std::function<void()>, typename Cleanup_t = std::function<void()>>
|
||||
template<typename Frame_t = std::function<void()>, typename Cleanup_t = std::function<void()>>
|
||||
struct WorkItemCallabale : IWorkItemHandler
|
||||
{
|
||||
Frame_t frame;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: ModuleInfo.hpp
|
||||
File: ProcessMap.hpp
|
||||
Date: 2021-6-10
|
||||
Author: Reece
|
||||
***/
|
||||
|
@ -1,7 +1,7 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: ConditionalEx.hpp
|
||||
File: ConditionEx.hpp
|
||||
Date: 2021-6-11
|
||||
Author: Reece
|
||||
***/
|
||||
|
@ -1,3 +1,10 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: IThreadFeature.hpp
|
||||
Date: 2021-6-25
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
namespace Aurora::Threading::Threads
|
||||
|
@ -1,3 +1,10 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: Async.cpp
|
||||
Date: 2021-6-26
|
||||
Author: Reece
|
||||
***/
|
||||
#include <RuntimeInternal.hpp>
|
||||
#include "Async.hpp"
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: Async.hpp
|
||||
Date: 2021-6-26
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
namespace Aurora::Async
|
||||
|
@ -1,3 +1,10 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: AsyncApp.cpp
|
||||
Date: 2021-6-26
|
||||
Author: Reece
|
||||
***/
|
||||
#include <RuntimeInternal.hpp>
|
||||
#include "AsyncApp.hpp"
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: AsyncApp.hpp
|
||||
Date: 2021-6-26
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
namespace Aurora::Async
|
||||
|
@ -1,3 +1,10 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: Schedular.cpp
|
||||
Date: 2021-6-26
|
||||
Author: Reece
|
||||
***/
|
||||
#include <RuntimeInternal.hpp>
|
||||
#include "Schedular.hpp"
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: Schedular.hpp
|
||||
Date: 2021-6-26
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
namespace Aurora::Async
|
||||
|
@ -1,3 +1,10 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: WorkItem.cpp
|
||||
Date: 2021-6-26
|
||||
Author: Reece
|
||||
***/
|
||||
#include <RuntimeInternal.hpp>
|
||||
#include "WorkItem.hpp"
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: WorkItem.hpp
|
||||
Date: 2021-6-26
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
namespace Aurora::Async
|
||||
|
@ -46,9 +46,9 @@ namespace Aurora::Threading::Primitives
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state_++;
|
||||
state_++;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -62,9 +62,9 @@ namespace Aurora::Threading::Primitives
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state_ = -1;
|
||||
state_ = -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ namespace Aurora::Threading::Primitives
|
||||
return false;
|
||||
}
|
||||
|
||||
state_++;
|
||||
state_++;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ namespace Aurora::Threading::Primitives
|
||||
return false;
|
||||
}
|
||||
|
||||
state_ = -1;
|
||||
state_ = -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -98,10 +98,10 @@ namespace Aurora::Threading::Primitives
|
||||
{
|
||||
LockGuardPtr<IConditionMutex> mutex(mutex_.get());
|
||||
|
||||
if(--state_ == 0)
|
||||
if(--state_ == 0)
|
||||
{
|
||||
condition_->Signal();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RWLockImpl::UnlockWrite()
|
||||
|
Loading…
Reference in New Issue
Block a user