mirror of
https://github.com/openharmony/developtools_global_resource_tool.git
synced 2026-07-18 17:24:42 -04:00
stop copy binary file when resources compile process failed
Signed-off-by: liule <liule21@huawei.com>
This commit is contained in:
@@ -28,6 +28,7 @@ public:
|
||||
explicit BinaryFilePacker(const PackageParser &packageParser, const std::string &moduleName);
|
||||
~BinaryFilePacker();
|
||||
std::future<uint32_t> CopyBinaryFileAsync(const std::vector<std::string> &inputs);
|
||||
void StopCopy();
|
||||
|
||||
private:
|
||||
uint32_t CopyBinaryFile(const std::vector<std::string> &inputs);
|
||||
@@ -38,6 +39,7 @@ private:
|
||||
std::string moduleName_;
|
||||
ThreadPool threadPool_;
|
||||
std::vector<std::future<uint32_t>> copyResults_;
|
||||
std::atomic<bool> stopCopy_{false};
|
||||
};
|
||||
} // namespace Restool
|
||||
} // namespace Global
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
|
||||
#include "cmd_parser.h"
|
||||
#include "config_parser.h"
|
||||
#include "resource_util.h"
|
||||
#include "resource_item.h"
|
||||
#include "resource_data.h"
|
||||
#include "resource_append.h"
|
||||
#include "resource_data.h"
|
||||
#include "resource_item.h"
|
||||
#include "resource_merge.h"
|
||||
#include "resource_util.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
@@ -49,6 +50,7 @@ private:
|
||||
uint32_t PackPreview();
|
||||
uint32_t PackAppend();
|
||||
uint32_t PackCombine();
|
||||
uint32_t PackQualifierResources(const ResourceMerge &resourceMerge);
|
||||
uint32_t HandleFeature();
|
||||
uint32_t FindResourceItems(const std::map<int64_t, std::vector<ResourceItem>> &resInfoLocal,
|
||||
std::vector<ResourceItem> &items, int64_t id) const;
|
||||
|
||||
@@ -74,11 +74,6 @@ std::future<typename std::result_of<F(Args...)>::type> ThreadPool::Enqueue(F &&f
|
||||
auto task = std::make_shared<p_task>(std::bind(std::forward<F>(f), std::forward<Args>(args)...));
|
||||
|
||||
std::future<return_type> res = task->get_future();
|
||||
if (!running_ || workerThreads_.empty()) {
|
||||
// If the pool is not running or there are no worker threads, execute the task immediately
|
||||
(*task)();
|
||||
return res;
|
||||
}
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(queueMutex_);
|
||||
tasks_.emplace([task]() { (*task)(); });
|
||||
|
||||
Reference in New Issue
Block a user