mirror of
https://gitee.com/openharmony/developtools_hdc
synced 2025-02-17 09:47:51 +00:00
fix: check nThreads less than zero.
Signed-off-by: TaowerfulMAX <liurantao@huawei.com>
This commit is contained in:
parent
12e6afd992
commit
ff185e183a
@ -104,18 +104,9 @@ bool ForkChildCheck(int argc, const char *argv[])
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t CheckUvThreadConfig()
|
||||
static size_t CheckUvThreadConfig()
|
||||
{
|
||||
string nThreadsString;
|
||||
bool ret = SystemDepend::GetDevItem("persist.hdc.uv.threads", nThreadsString);
|
||||
if (!ret) {
|
||||
return SIZE_THREAD_POOL;
|
||||
}
|
||||
size_t nThreads = atoi(nThreadsString.c_str());
|
||||
if (nThreads <= 0) {
|
||||
nThreads = SIZE_THREAD_POOL;
|
||||
}
|
||||
return nThreads;
|
||||
return SystemDepend::GetDevUint("persist.hdc.uv.threads", SIZE_THREAD_POOL);
|
||||
}
|
||||
|
||||
int BackgroundRun()
|
||||
|
@ -69,6 +69,11 @@ namespace SystemDepend {
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32_t GetDevUint(const char *key, uint32_t defaultValue)
|
||||
{
|
||||
return GetUintParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
bool CallDoReboot(const char *reason)
|
||||
{
|
||||
string rebootCtrl = "ohos.startup.powerctrl";
|
||||
|
@ -31,6 +31,7 @@ namespace SystemDepend {
|
||||
#else
|
||||
bool GetDevItem(const char *key, string &out, const char *preDefine = nullptr);
|
||||
bool SetDevItem(const char *key, const char *value);
|
||||
uint32_t GetDevUint(const char *key, uint32_t defaultValue);
|
||||
#endif
|
||||
bool RebootDevice(const string &cmd);
|
||||
} // namespace SystemDepend
|
||||
|
@ -299,7 +299,7 @@ group("hdc_unittest") {
|
||||
config("hdc_test_config") {
|
||||
cflags = code_check_flag
|
||||
ldflags = []
|
||||
defines = []
|
||||
defines = [ "HARMONY_PROJECT" ]
|
||||
|
||||
if (hdc_test_coverage && is_ohos) {
|
||||
defines += [ "TEST_COVERAGE" ]
|
||||
|
Loading…
x
Reference in New Issue
Block a user