diff --git a/bundle.json b/bundle.json index 8a10894..eaef11a 100644 --- a/bundle.json +++ b/bundle.json @@ -47,7 +47,8 @@ "//foundation/resourceschedule/qos_manager/services:concurrentsvc", "//foundation/resourceschedule/qos_manager/frameworks/concurrent_task_client:concurrent_task_client", "//foundation/resourceschedule/qos_manager/qos:qos", - "//foundation/resourceschedule/qos_manager/frameworks/native:qos_ndk" + "//foundation/resourceschedule/qos_manager/frameworks/native:qos_ndk", + "//foundation/resourceschedule/qos_manager/qos:pi_mutex" ], "inner_kits": [ { @@ -63,11 +64,19 @@ "header": { "header_base": "//foundation/resourceschedule/qos_manager/interfaces/inner_api/", "header_files": [ - "qos.h", - "pi_mutex.h" + "qos.h" ] }, "name": "//foundation/resourceschedule/qos_manager/qos:qos" + }, + { + "header": { + "header_base": "//foundation/resourceschedule/qos_manager/interfaces/inner_api/", + "header_files": [ + "pi_mutex.h" + ] + }, + "name": "//foundation/resourceschedule/qos_manager/qos:pi_mutex" } ], "test": [ diff --git a/frameworks/concurrent_task_client/src/concurrent_task_client.cpp b/frameworks/concurrent_task_client/src/concurrent_task_client.cpp index d095e48..62dc04b 100644 --- a/frameworks/concurrent_task_client/src/concurrent_task_client.cpp +++ b/frameworks/concurrent_task_client/src/concurrent_task_client.cpp @@ -184,7 +184,7 @@ void ConcurrentTaskClient::StopRemoteObject() clientService_ = nullptr; } -int ConcurrentTaskClient::SetSystemQoS(int tid, int level) +int ConcurrentTaskClient::SetSystemQoS([[maybe_unused]] int tid, [[maybe_unused]] int level) { return 0; } diff --git a/interfaces/inner_api/pi_mutex.h b/interfaces/inner_api/pi_mutex.h index db35d97..3689498 100644 --- a/interfaces/inner_api/pi_mutex.h +++ b/interfaces/inner_api/pi_mutex.h @@ -13,21 +13,27 @@ * limitations under the License. */ -#ifndef QOS_PI_MUETX_H -#define QOS_PI_MUETX_H +#ifndef QOS_MANAGER_PI_MUETX_H +#define QOS_MANAGER_PI_MUETX_H #include -#include #include namespace OHOS { -namespace QOS { -class PiMutex : public std::mutex { +namespace PiMutex { +template> +struct HasType : std::false_type {}; + +template +struct HasType> : std::true_type {}; + +template +class PiMutex : public Mutex { public: PiMutex() { - if constexpr (std::is_same_v) { - std::mutex::native_handle_type handle = std::mutex::native_handle(); + if constexpr (HasType && std::is_same_v) { + typename Mutex::native_handle_type handle = Mutex::native_handle(); pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT); @@ -43,4 +49,4 @@ public: } // namespace QOS } // namespace OHOS -#endif // QOS_PI_MUETX_H +#endif // QOS_MANAGER_PI_MUETX_H diff --git a/qos/BUILD.gn b/qos/BUILD.gn index 971959a..7e10ace 100644 --- a/qos/BUILD.gn +++ b/qos/BUILD.gn @@ -56,3 +56,9 @@ ohos_shared_library("qos") { subsystem_name = "resourceschedule" part_name = "qos_manager" } + +ohos_shared_headers("pi_mutex") { + include_dirs = [ "../interfaces/inner_api/" ] + subsystem_name = "resourceschedule" + part_name = "qos_manager" +} diff --git a/qos/qos.cpp b/qos/qos.cpp index 3a62ebf..d5ef81f 100644 --- a/qos/qos.cpp +++ b/qos/qos.cpp @@ -127,22 +127,22 @@ int GetQosForOtherThread(enum QosLevel &level, int tid) return QosController::GetInstance().GetThreadQosForOtherThread(level, tid); } -int AddThreadToProcRtg(int tid) +int AddThreadToProcRtg([[maybe_unused]] int tid) { return 0; } -int AddThreadsToProcRtg(int tid[5], int size) +int AddThreadsToProcRtg([[maybe_unused]] int tid[5], [[maybe_unused]] int size) { return 0; } -int RemoveThreadFromProcRtg(int tid) +int RemoveThreadFromProcRtg([[maybe_unused]] int tid) { return 0; } -int RemoveThreadsFromProcRtg(int tid[5], int size) +int RemoveThreadsFromProcRtg([[maybe_unused]] int tid[5], [[maybe_unused]] int size) { return 0; }