forked from mindspore-Ecosystem/mindspore
fix vs run bug
This commit is contained in:
parent
50bbdfef17
commit
4c5732c642
|
@ -121,7 +121,7 @@ class MS_API Status {
|
|||
inline std::string GetErrDescription() const;
|
||||
inline std::string SetErrDescription(const std::string &err_description);
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &os, const Status &s);
|
||||
MS_API friend std::ostream &operator<<(std::ostream &os, const Status &s);
|
||||
|
||||
bool operator==(const Status &other) const;
|
||||
bool operator==(enum StatusCode other_code) const;
|
||||
|
|
|
@ -205,11 +205,7 @@ class ActorBase {
|
|||
|
||||
AID id;
|
||||
std::map<std::string, ActorFunction> actionFunctions;
|
||||
#ifdef _MSC_VER
|
||||
std::recursive_mutex waiterLock;
|
||||
#else
|
||||
std::mutex waiterLock;
|
||||
#endif
|
||||
std::string msgRecords[MAX_ACTOR_RECORD_SIZE];
|
||||
uint32_t recordNextPoint = 0;
|
||||
|
||||
|
|
|
@ -40,8 +40,20 @@ void ActorBase::Await() {
|
|||
// lock here or at spawn(). and unlock here or at worker(). wait for the worker to finish.
|
||||
MS_LOG(DEBUG) << "ACTOR is waiting for terminate to finish. a=" << actorName.c_str();
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define TRY_LOCK_INTERVAL 10
|
||||
while (true) {
|
||||
if (waiterLock.try_lock()) {
|
||||
waiterLock.unlock();
|
||||
break;
|
||||
} else {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(TRY_LOCK_INTERVAL));
|
||||
}
|
||||
}
|
||||
#else
|
||||
waiterLock.lock();
|
||||
waiterLock.unlock();
|
||||
#endif
|
||||
|
||||
// mailbox's hook may hold the actor reference, we need explicitly free the mailbox to avoid the memory leak. the
|
||||
// details can refer to the comments in ActorMgr::Spawn
|
||||
|
|
Loading…
Reference in New Issue