!20194 [MSLITE] mindrt bug : thread pool error

Merge pull request !20194 from ling/core_1.3
This commit is contained in:
i-robot 2021-07-14 01:11:14 +00:00 committed by Gitee
commit d9493456c8
3 changed files with 8 additions and 3 deletions

View File

@ -64,6 +64,9 @@ struct OpContext {
const void *kernel_call_back_after_;
void SetFailed(int32_t code) {
if (code == MindrtStatus::KINIT) {
code = MindrtStatus::KERROR;
}
for (auto promise : *results_) {
promise.SetFailed(code);
}

View File

@ -66,9 +66,10 @@ int ActorBase::EnqueMessage(std::unique_ptr<MessageBase> &&msg) { return actorPo
void ActorBase::Quit() {
Finalize();
actorPolicy->Terminate(this);
// lock at spawn(), unlock here.
waiterLock.unlock();
actorPolicy->Terminate(this);
}
void ActorBase::Run() {

View File

@ -76,13 +76,14 @@ ShardedThread::~ShardedThread() {}
void ShardedThread::Terminate(const ActorBase *aActor) {
std::string actorName = aActor->GetAID().Name();
MS_LOG(DEBUG) << "ACTOR ShardedThread received terminate message,v=" << actorName.c_str();
// remove actor from actorMgr
ActorMgr::GetActorMgrRef()->RemoveActor(actorName);
mailboxLock.lock();
terminated = true;
this->actor = nullptr;
mailboxLock.unlock();
// remove actor from actorMgr
ActorMgr::GetActorMgrRef()->RemoveActor(actorName);
}
int ShardedThread::EnqueMessage(std::unique_ptr<MessageBase> &&msg) {