1 /* 2 * Copyright (c) 2025-2026 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 #ifndef NETWORKSLICE_LOOP_MANAGER 16 #define NETWORKSLICE_LOOP_MANAGER 17 #pragma once 18 #include <string> 19 #include <memory> 20 #include <unordered_map> 21 22 #include "singleton.h" 23 #include "event_runner.h" 24 #include "netmgr_ext_log_wrapper.h" 25 26 namespace OHOS { 27 namespace NetManagerStandard { 28 29 enum LooperType { 30 OLLIE_MESSAGE_THREAD 31 }; 32 33 class NetworkSlice_Loop_Manager final { 34 DECLARE_DELAYED_SINGLETON(NetworkSlice_Loop_Manager); 35 public: 36 void init(); 37 38 bool submitTask(); 39 std::shared_ptr<AppExecFwk::EventRunner> getLoop(LooperType type); 40 41 private: 42 void initLoopMap(); 43 std::unordered_map<LooperType, std::shared_ptr<AppExecFwk::EventRunner>> loopMap_; 44 }; 45 } // namespace NetManagerStandard 46 } // namespace OHOS 47 48 #endif // NETWORKSLICE_LOOP_MANAGER 49