mirror of
https://github.com/openharmony/ark_js_runtime.git
synced 2026-08-27 02:31:17 -04:00
Fix destructor collapsion when exit
Signed-off-by: zhangyukun <zhangyukun8@huawei.com> Change-Id: I9d1e7d1b23e60fa1b780b9a19fe8da0330b17573
This commit is contained in:
@@ -29,7 +29,11 @@ void Platform::Initialize(int threadNum)
|
||||
void Platform::Destroy()
|
||||
{
|
||||
os::memory::LockHolder lock(mutex_);
|
||||
if (--isInitialized_ <= 0) {
|
||||
if (isInitialized_ <= 0) {
|
||||
return;
|
||||
}
|
||||
isInitialized_--;
|
||||
if (isInitialized_ == 0) {
|
||||
runner_->TerminateThread();
|
||||
} else {
|
||||
runner_->TerminateTask();
|
||||
|
||||
@@ -31,7 +31,12 @@ public:
|
||||
}
|
||||
|
||||
Platform() = default;
|
||||
~Platform() = default;
|
||||
~Platform()
|
||||
{
|
||||
os::memory::LockHolder lock(mutex_);
|
||||
runner_->TerminateThread();
|
||||
isInitialized_ = 0;
|
||||
}
|
||||
|
||||
NO_COPY_SEMANTIC(Platform);
|
||||
NO_MOVE_SEMANTIC(Platform);
|
||||
|
||||
Reference in New Issue
Block a user