From 03785c6d05bb5cdeefa6c51e90b23b16503da057 Mon Sep 17 00:00:00 2001 From: liuyuxiu Date: Tue, 28 May 2024 09:00:39 +0800 Subject: [PATCH] fixed 4ac2b6f from https://gitee.com/YuXiuLiu/resourceschedule_qos_manager/pulls/125 qos switch adapte cross_platform Signed-off-by: liuyuxiu --- qos/qos.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/qos/qos.cpp b/qos/qos.cpp index fc928a6..6c6d91f 100644 --- a/qos/qos.cpp +++ b/qos/qos.cpp @@ -16,7 +16,9 @@ #include #include #include "concurrent_task_log.h" +#if !defined(CROSS_PLATFORM) #include "parameters.h" +#endif #include "qos_interface.h" #include "qos.h" using namespace OHOS::ConcurrentTask; @@ -33,12 +35,14 @@ QosController& QosController::GetInstance() int QosController::SetThreadQosForOtherThread(enum QosLevel level, int tid) { +#if !defined(CROSS_PLATFORM) bool qosEnable = OHOS::system::GetBoolParameter("persist.all.setQos.on", true); - int qos = static_cast(level); if (!qosEnable) { - CONCUR_LOGD("[Qos] qoslevel %{public}d apply for tid %{public}d disable", qos, tid); + CONCUR_LOGD("[Qos] qoslevel %{public}d apply for tid %{public}d disable", static_cast(level), tid); return 0; } +#endif + int qos = static_cast(level); if (level < QosLevel::QOS_BACKGROUND || level >= QosLevel::QOS_MAX) { CONCUR_LOGE("[Qos] invalid qos level %{public}d", qos); return ERROR_NUM; @@ -55,11 +59,13 @@ int QosController::SetThreadQosForOtherThread(enum QosLevel level, int tid) int QosController::ResetThreadQosForOtherThread(int tid) { +#if !defined(CROSS_PLATFORM) bool qosEnable = OHOS::system::GetBoolParameter("persist.all.setQos.on", true); if (!qosEnable) { CONCUR_LOGD("[Qos] qoslevel reset disable for tid %{public}d.", tid); return 0; } +#endif int ret = QosLeaveForOther(tid); if (ret == 0) { CONCUR_LOGD("[Qos] qoslevel reset for tid %{public}d success", tid); -- Gitee