Skip to content

Commit 894476b

Browse files
committed
[bugfix] fix cannot recursive in one thread get bug, only in cpp11.
1 parent 01ef709 commit 894476b

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/GraphCtrl/GraphParam/GParam.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define CGRAPH_GPARAM_H
1111

1212
#include <set>
13+
#include <mutex>
1314

1415
#include "GParamObject.h"
1516

@@ -20,7 +21,7 @@ class GParam : public GParamObject {
2021
#if __cplusplus >= 201703L
2122
std::shared_mutex _param_shared_lock_; // 用于参数互斥的锁信息
2223
#else
23-
std::mutex _param_shared_lock_;
24+
std::recursive_mutex _param_shared_lock_;
2425
#endif
2526

2627
/**

src/UtilsCtrl/UtilsDefine.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ using CGRAPH_UNIQUE_LOCK = std::unique_lock<std::mutex>;
3939
using CGRAPH_READ_LOCK = std::shared_lock<std::shared_mutex>;
4040
using CGRAPH_WRITE_LOCK = std::unique_lock<std::shared_mutex>;
4141
#else
42-
using CGRAPH_READ_LOCK = CGRAPH_LOCK_GUARD; // C++11和14不支持读写锁,使用mutex替代
43-
using CGRAPH_WRITE_LOCK = CGRAPH_LOCK_GUARD;
42+
using CGRAPH_READ_LOCK = std::lock_guard<std::recursive_mutex>; // C++11和14不支持读写锁,使用mutex替代
43+
using CGRAPH_WRITE_LOCK = std::lock_guard<std::recursive_mutex>;
4444
#endif
4545

4646
template<typename T>

tutorial/T27-Trim.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
@File: T27-Trim.cpp
55
@Time: 2024/9/28 21:43
6-
@Desc: 本例主要演示,通过 Trim() 方法,修剪pipeline中的冗余依赖逻辑
6+
@Desc: 本例主要演示,通过 trim() 方法,修剪pipeline中的冗余依赖逻辑
77
***************************/
88

99
#include "MyGNode/MyNode1.h"

0 commit comments

Comments
 (0)