• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef RESSCHED_INTERFACES_INNERKITS_RESSCHED_CLIENT_INCLUDE_RES_SA_INIT_H
17 #define RESSCHED_INTERFACES_INNERKITS_RESSCHED_CLIENT_INCLUDE_RES_SA_INIT_H
18 
19 #include <mutex>
20 #include <unordered_set>
21 
22 namespace OHOS {
23 namespace ResourceSchedule {
24 class ResSchedSaInit {
25 public:
26     std::mutex saInitXmlMutex_;
27 public:
28     /**
29      * @brief Get the Instance object.
30      *
31      * @return Returns ResSchedSaInit&.
32      */
33     static ResSchedSaInit& GetInstance();
34 };
35 
36 class ResSchedIpcThread {
37 private:
38     int32_t selfPid_;
39     std::unordered_set<int32_t> ipcThreadTids_;
40     std::mutex ipcThreadSetQosMutex_;
41     std::atomic<bool> isInit_ = {false};
42     const uint32_t MAX_IPC_THREAD_NUM = 32;
43     const uint32_t RSS_IPC_QOS_LEVEL = 7;
44     const std::string RSS_BUNDLE_NAME = "resource_schedule_service";
45 
46 public:
47     /**
48      * @brief Get the Instance object.
49      *
50      * @return Returns ResSchedIpcThread&.
51      */
52     static ResSchedIpcThread& GetInstance();
53 
54     /**
55      * @brief SetQos.
56      *
57      * @param clientPid client pid.
58      */
59     void SetQos(int32_t clientPid);
60 
61     /**
62      * @brief SetInitFlag.
63      *
64      * @param flag init finish flag.
65      */
66     void SetInitFlag(bool flag);
67 };
68 } // namespace ResourceSchedule
69 } // namespace OHOS
70 
71 #endif // RESSCHED_INTERFACES_INNERKITS_RESSCHED_CLIENT_INCLUDE_RES_SA_INIT_H
72