Library/Thread: Implement AyncFunctorThread (#846)

This commit is contained in:
MissBismuth 2026-01-04 17:31:39 +01:00 committed by GitHub
parent e9bcc135ee
commit 95f8c3dcfa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 3 deletions

View file

@ -286514,15 +286514,15 @@ Library/Thread/AsyncFunctorThread.o:
- offset: 0xa2bd18
size: 128
label: _ZN2al30createAndStartInitializeThreadEPN4sead4HeapEiRKNS_11FunctorBaseE
status: NotDecompiled
status: Matching
- offset: 0xa2bd98
size: 4
label: _ZN2al37tryWaitDoneAndDestroyInitializeThreadEPNS_16InitializeThreadE
status: NotDecompiled
status: Matching
- offset: 0xa2bd9c
size: 144
label: _ZN2al16getCurrentCoreIdEv
status: NotDecompiled
status: Matching
Library/Yaml/ByamlIter.o:
'.text':
- offset: 0xa2be2c

View file

@ -42,4 +42,23 @@ bool AsyncFunctorThread::isDone() const {
return mIsDone;
}
InitializeThread* createAndStartInitializeThread(sead::Heap* heap, s32 priority,
const FunctorBase& functor) {
InitializeThread* initializeThread =
new InitializeThread("シーン初期化スレッド", functor, heap, priority, 0x100000);
initializeThread->start();
return initializeThread;
}
bool tryWaitDoneAndDestroyInitializeThread(InitializeThread* thread) {
return thread->tryWaitDoneAndDestroy();
}
sead::CoreId getCurrentCoreId() {
sead::CoreIdMask mask = sead::ThreadMgr::instance()->getCurrentThread()->getAffinity();
for (u8 i = sead::CoreId::cMain; i <= sead::CoreId::cSub2; i++)
if (mask.isOn(i))
return i;
return sead::CoreId::cMain;
}
} // namespace al

View file

@ -5,6 +5,7 @@
#include <prim/seadSafeString.h>
#include "Library/Thread/FunctorV0M.h"
#include "Project/Thread/InitializeThread.h"
namespace sead {
class DelegateThread;
@ -29,4 +30,8 @@ private:
};
static_assert(sizeof(AsyncFunctorThread) == 0x20);
InitializeThread* createAndStartInitializeThread(sead::Heap*, s32, const FunctorBase&);
bool tryWaitDoneAndDestroyInitializeThread(InitializeThread*);
sead::CoreId getCurrentCoreId();
} // namespace al