[+] Added async semantic ->Then(...)
This commit is contained in:
parent
29e5593308
commit
28a840f71d
@ -85,6 +85,8 @@ namespace Aurora::Async
|
||||
virtual AuSPtr<IWorkItem> SetSchedTime(AuUInt32 ms) = 0;
|
||||
virtual AuSPtr<IWorkItem> SetSchedTimeNs(AuUInt64 ns) = 0;
|
||||
|
||||
virtual AuSPtr<IWorkItem> Then(const AuSPtr<IWorkItem> &next) = 0;
|
||||
|
||||
virtual AuSPtr<IWorkItem> Dispatch() = 0;
|
||||
|
||||
virtual bool BlockUntilComplete() = 0;
|
||||
|
@ -54,6 +54,7 @@ namespace Aurora::Async
|
||||
return AU_SHARED_FROM_THIS;
|
||||
}
|
||||
|
||||
|
||||
AuSPtr<IWorkItem> WorkItem::WaitFor(const AuList<AuSPtr<IWorkItem>> &workItems)
|
||||
{
|
||||
bool status {};
|
||||
@ -84,6 +85,13 @@ namespace Aurora::Async
|
||||
return AU_SHARED_FROM_THIS;
|
||||
}
|
||||
|
||||
AuSPtr<IWorkItem> WorkItem::Then(const AuSPtr<IWorkItem> &next)
|
||||
{
|
||||
auto that = AU_SHARED_FROM_THIS;
|
||||
next->WaitFor(that);
|
||||
next->Dispatch();
|
||||
return that;
|
||||
}
|
||||
|
||||
AuSPtr<IWorkItem> WorkItem::SetSchedTimeNs(AuUInt64 ns)
|
||||
{
|
||||
|
@ -19,6 +19,7 @@ namespace Aurora::Async
|
||||
AuSPtr<IWorkItem> WaitFor(const AuList<AuSPtr<IWorkItem>> &workItem) override;
|
||||
AuSPtr<IWorkItem> SetSchedTime(AuUInt32 ms) override;
|
||||
AuSPtr<IWorkItem> SetSchedTimeNs(AuUInt64 ns) override;
|
||||
AuSPtr<IWorkItem> Then(const AuSPtr<IWorkItem> &next) override;
|
||||
|
||||
AuSPtr<IWorkItem> Dispatch() override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user