1 /* 2 * Copyright (c) 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 #define LOG_TAG "ThreadManager" 16 #include "thread/thread_manager.h" 17 18 #include "log_print.h" 19 #include "types.h" 20 #include "unistd.h" 21 namespace OHOS::DistributedData { ThreadManager()22ThreadManager::ThreadManager() 23 { 24 } 25 GetInstance()26ThreadManager &ThreadManager::GetInstance() 27 { 28 static ThreadManager instance; 29 return instance; 30 } 31 Initialize(uint32_t minThreadNum,uint32_t maxThreadNum,uint32_t ipcThreadNum)32void ThreadManager::Initialize(uint32_t minThreadNum, uint32_t maxThreadNum, uint32_t ipcThreadNum) 33 { 34 minThreadNum_ = minThreadNum; 35 maxThreadNum_ = maxThreadNum; 36 ipcThreadNum_ = ipcThreadNum; 37 } 38 GetMinThreadNum()39uint32_t ThreadManager::GetMinThreadNum() 40 { 41 return minThreadNum_; 42 } 43 GetMaxThreadNum()44uint32_t ThreadManager::GetMaxThreadNum() 45 { 46 return maxThreadNum_; 47 } 48 GetIpcThreadNum()49uint32_t ThreadManager::GetIpcThreadNum() 50 { 51 return ipcThreadNum_; 52 } 53 } // namespace OHOS::DistributedData