Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 :
11 : #ifndef DUMP_THREAD_MANAGER_H
12 : #define DUMP_THREAD_MANAGER_H
13 : #include <set>
14 : #include <mutex>
15 : #include <condition_variable>
16 : #include "common/singleton.h"
17 :
18 : namespace Adx{
19 : class ThreadManager: public Adx::Common::Singleton::Singleton<ThreadManager> {
20 : public:
21 1 : ThreadManager(){};
22 : ~ThreadManager() override;
23 : void TaskAdd(int32_t tid);
24 : void TaskDone(int32_t tid);
25 : void WaitAll();
26 : private:
27 : std::mutex mtx_;
28 : std::set<int32_t> threads_;
29 : std::condition_variable cv_;
30 : };
31 : }
32 : #endif
|