OdysseyDecomp/lib/al/Library/Thread/AsyncFunctorThread.h

38 lines
1,002 B
C++

#pragma once
#include <basis/seadTypes.h>
#include <mc/seadCoreInfo.h>
#include <prim/seadSafeString.h>
#include "Library/Thread/FunctorV0M.h"
#include "Project/Thread/InitializeThread.h"
namespace sead {
class DelegateThread;
class Thread;
} // namespace sead
namespace al {
class AsyncFunctorThread {
public:
AsyncFunctorThread(const sead::SafeString& functor_name, const FunctorBase& functor,
s32 priority, s32 stack_size, sead::CoreId id);
virtual ~AsyncFunctorThread();
void threadFunction(sead::Thread* unused_1, s64 unused_2);
void start();
bool isDone() const;
private:
sead::DelegateThread* mDelegateThread = nullptr;
FunctorBase* mFunctor = nullptr;
bool mIsDone = true;
};
static_assert(sizeof(AsyncFunctorThread) == 0x20);
InitializeThread* createAndStartInitializeThread(sead::Heap*, s32, const FunctorBase&);
bool tryWaitDoneAndDestroyInitializeThread(InitializeThread*);
sead::CoreId getCurrentCoreId();
} // namespace al