forked from huawei/mindspore2022
!20194 [MSLITE] mindrt bug : thread pool error
Merge pull request !20194 from ling/core_1.3
This commit is contained in:
commit
d9493456c8
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue