GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [feat] add _CGRAPH_GPARAM_RWLOCK_ENABLE_ · feiyunwill/CGraph@441296c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • CMakeLists.txt
  • python
    • PyCGraph.cpp
    • tutorial
      • T01-Simple.py
  • src/UtilsCtrl
    • UtilsDefine.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎CMakeLists.txt‎

Copy file name to clipboardExpand all lines: CMakeLists.txt
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ option(CGRAPH_BUILD_PERFORMANCE_TESTS "Enables builds of performance tests" OFF)
2929
# 此宏可以在纯并发的微小任务下,用于提升整体性能。主要用于在性能测试的情况下使用,一般情况不推荐打开
3030
# add_definitions(-D_CGRAPH_PARALLEL_MICRO_BATCH_ENABLE_)
3131

32+
# 此宏用于在读写GParam加锁的时候,加锁方式修改为读写锁的情况
33+
# 仅在cpp17或以上版本生效
34+
# 打开后会在多读少写的情况下有性能优化
35+
# 副作用是GParam中的锁无法递归上锁,一般情况下可忽略影响
36+
# add_definitions(-D_CGRAPH_GPARAM_RWLOCK_ENABLE_)
37+
3238
# add CGraph environment info
3339
include(cmake/CGraph-env-include.cmake)
3440

Collapse file

‎python/PyCGraph.cpp‎

Copy file name to clipboardExpand all lines: python/PyCGraph.cpp
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,10 @@ PYBIND11_MODULE(PyCGraph, m) {
124124
py::return_value_policy::reference)
125125
.def("getCode", &CStatus::getCode)
126126
.def("getInfo", &CStatus::getInfo)
127+
.def("reset", &CStatus::reset)
127128
.def("isOK", &CStatus::isOK)
128-
.def("isErr", &CStatus::isErr);
129+
.def("isErr", &CStatus::isErr)
130+
.def("isCrash", &CStatus::isCrash);
129131

130132
py::class_<GAspect, PywGAspect, std::unique_ptr<GAspect, py::nodelete> >(m, "GAspect")
131133
.def(py::init<>())
Collapse file

‎python/tutorial/T01-Simple.py‎

Copy file name to clipboardExpand all lines: python/tutorial/T01-Simple.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ def tutorial_simple():
2323

2424
status: CStatus = pipeline.init()
2525
if status.isErr():
26-
# please check api return value.
27-
print('pipeline init failed, error code is {0}.'.format(status.getCode()))
26+
# please check api return status
27+
# ret_code == 0 is ok, default
28+
# ret_code < 0 means error, ex: return CStatus(-1, "my error info")
29+
print('pipeline init failed, error code is {0}, error info is {1}'.format(
30+
status.getCode(), status.getInfo()))
2831
return
2932

3033
for i in range(0, 3):
Collapse file

‎src/UtilsCtrl/UtilsDefine.h‎

Copy file name to clipboardExpand all lines: src/UtilsCtrl/UtilsDefine.h
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ CGRAPH_NAMESPACE_BEGIN
3535
using CGRAPH_LOCK_GUARD = std::lock_guard<std::mutex>;
3636
using CGRAPH_UNIQUE_LOCK = std::unique_lock<std::mutex>;
3737

38-
#if __cplusplus >= 201703L
38+
#if __cplusplus >= 201703L && _CGRAPH_GPARAM_RWLOCK_ENABLE_
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 = std::lock_guard<std::recursive_mutex>; // C++11和14不支持读写锁,使用mutex替代
42+
using CGRAPH_READ_LOCK = std::lock_guard<std::recursive_mutex>; // C++11和14不支持读写锁,使用 recursive_mutex 替代
4343
using CGRAPH_WRITE_LOCK = std::lock_guard<std::recursive_mutex>;
4444
#endif
4545

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.