mirror of
https://github.com/openharmony/developtools_global_resource_tool.git
synced 2026-07-18 09:14:48 -04:00
@@ -37,7 +37,6 @@ protected:
|
||||
virtual bool IsDuplicated(const std::unique_ptr<FileEntry> &entry, std::string subPath);
|
||||
PackageParser packageParser_;
|
||||
std::string moduleName_;
|
||||
ThreadPool threadPool_;
|
||||
std::vector<std::future<uint32_t>> copyResults_;
|
||||
std::atomic<bool> stopCopy_{false};
|
||||
std::mutex mutex_;
|
||||
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
const std::vector<std::string> &GetSysIdDefinedPaths() const;
|
||||
const std::string &GetCompressionPath() const;
|
||||
bool IsOverlap() const;
|
||||
size_t GetThreadCount() const;
|
||||
|
||||
private:
|
||||
void InitCommand();
|
||||
@@ -83,6 +84,7 @@ private:
|
||||
uint32_t IconCheck();
|
||||
uint32_t ParseTargetConfig(const std::string &argValue);
|
||||
uint32_t AddCompressionPath(const std::string &argValue);
|
||||
uint32_t ParseThread(const std::string &argValue);
|
||||
|
||||
static const struct option CMD_OPTS[];
|
||||
static const std::string CMD_PARAMS;
|
||||
@@ -108,6 +110,7 @@ private:
|
||||
bool isTtargetConfig_;
|
||||
std::vector<std::string> sysIdDefinedPaths_;
|
||||
std::string compressionPath_;
|
||||
size_t threadCount_{ 0 };
|
||||
};
|
||||
} // namespace Restool
|
||||
} // namespace Global
|
||||
|
||||
@@ -38,6 +38,7 @@ private:
|
||||
uint32_t GetArray(const cJSON *node, int c, HandleBack callback);
|
||||
uint32_t GetModuleNames(const cJSON *node, int c, HandleBack callback);
|
||||
uint32_t GetBool(const cJSON *node, int c, HandleBack callback);
|
||||
uint32_t GetNumber(const cJSON *node, int c, HandleBack callback);
|
||||
cJSON *root_;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -49,11 +49,11 @@ const static std::string SOLUTIONS_ARROW = "> ";
|
||||
const static std::string LONG_PATH_HEAD = "\\\\?\\";
|
||||
const static int32_t VERSION_MAX_LEN = 128;
|
||||
const static int32_t INT_TO_BYTES = sizeof(uint32_t);
|
||||
static const int8_t RESTOOL_VERSION[VERSION_MAX_LEN] = { "Restool 5.1.0.004" };
|
||||
static const int8_t RESTOOL_VERSION[VERSION_MAX_LEN] = { "Restool 5.1.0.005" };
|
||||
const static int32_t TAG_LEN = 4;
|
||||
constexpr static int DEFAULT_POOL_SIZE = 8;
|
||||
static std::set<std::string> g_resourceSet;
|
||||
static std::set<std::string> g_hapResourceSet;
|
||||
const static int8_t THREAD_POOL_SIZE = 2;
|
||||
const static int8_t INVALID_ID = -1;
|
||||
|
||||
enum class KeyType {
|
||||
@@ -147,6 +147,7 @@ enum Option {
|
||||
TARGET_CONFIG = 5,
|
||||
DEFINED_SYSIDS = 6,
|
||||
COMPRESSED_CONFIG = 7,
|
||||
THREAD = 8,
|
||||
STARTID = 'e',
|
||||
FORCEWRITE = 'f',
|
||||
HELP = 'h',
|
||||
|
||||
@@ -30,17 +30,13 @@ namespace Global {
|
||||
namespace Restool {
|
||||
class ThreadPool {
|
||||
public:
|
||||
/**
|
||||
* @brief Creates a thread pool with specify thread count
|
||||
* @param threadCount the count of threads to be created
|
||||
*/
|
||||
explicit ThreadPool(const size_t threadCount);
|
||||
~ThreadPool();
|
||||
|
||||
/**
|
||||
* @brief Start the thread pool
|
||||
* @param threadCount the count of thread pool
|
||||
*/
|
||||
uint32_t Start();
|
||||
uint32_t Start(const size_t &threadCount);
|
||||
|
||||
/**
|
||||
* @brief Stop the thread pool
|
||||
@@ -55,7 +51,12 @@ public:
|
||||
template <class F, class... Args>
|
||||
std::future<typename std::result_of<F(Args...)>::type> Enqueue(F &&f, Args &&...args);
|
||||
|
||||
static ThreadPool &GetInstance();
|
||||
|
||||
private:
|
||||
ThreadPool();
|
||||
ThreadPool(const ThreadPool &) = delete;
|
||||
ThreadPool &operator=(const ThreadPool &) = delete;
|
||||
void WorkInThread();
|
||||
std::vector<std::thread> workerThreads_;
|
||||
std::queue<std::function<void()>> tasks_;
|
||||
@@ -63,7 +64,6 @@ private:
|
||||
std::mutex queueMutex_;
|
||||
std::condition_variable condition_;
|
||||
bool running_{ false };
|
||||
size_t threadCount_;
|
||||
};
|
||||
|
||||
template <typename F, typename... Args>
|
||||
|
||||
Reference in New Issue
Block a user