src/lib/framework/src/driverFramework.cpp学习


  1. int Framework::initialize()
  2. {
  3.     DF_LOG_DEBUG("Framework::initialize");

  4.     g_framework = new SyncObj;                                                    //这个应该是各同步类

  5.     if (!g_framework) {
  6.         DF_LOG_ERR("ERROR: falled to allocate g_framework");
  7.         return -1;
  8.     }

  9.     g_run_status = new RunStatus;                                                //这个是状态标识

  10.     if (!g_run_status) {
  11.         DF_LOG_ERR("g_run_status allocation failed");
  12.         return -2;
  13.     }

  14.     struct timespec ts = {};

  15.     int ret = absoluteTime(ts);                                                   //获取绝对时间

  16.     if (ret != 0) {
  17.         DF_LOG_ERR("ERROR: absoluteTime returned (%d)", ret);
  18.         return -4;
  19.     }

  20.     ret = HRTWorkQueue::instance().initialize();                                //初始化worker的线程

  21.     if (ret < 0) {
  22.         return ret - 10;
  23.     }

  24.     DF_LOG_DEBUG("Calling DevMgr::initialize");
  25.     ret = DevMgr::initialize();                                                    //加了一个标志位true

  26.     if (ret < 0) {
  27.         return ret - 20;
  28.     }

  29.     DF_LOG_DEBUG("Calling WorkMgr::initialize");
  30.     ret = WorkMgr::initialize();                                                    //这里也加了一个标志位true

  31.     if (ret < 0) {
  32.         return ret - 30;
  33.     }

  34.     return 0;
  35. }

  1. class SyncObj
  2. {
  3. public:
  4.     SyncObj();                                                    //构造函数
  5.     ~SyncObj() = default;

  6.     void lock();                                                //对Mutex上锁
  7.     void unlock();                                              //解锁

  8.     // Returns 0 on success, ETIMEDOUT on timeout                //返回0成功, ETIMEDOUT是超时
  9.     // Use timeout_us = 0 for blocking wait                    //使用timeout_us =0作为阻塞等待
  10.     int waitOnSignal(unsigned long timeout_us);

  11.     void signal();

  12. private:
  13.     pthread_mutex_t m_lock{};                                    //这个大括号是C++11,统一初始化
  14.     pthread_cond_t    m_new_data_cond{};
  15. };

<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
阅读(10) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
将QT += core QT -= gui CONFIG += c++11 TARGET = UavRectifyLoadLIb CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS win32{ CONFIG(debug, debug|release){ DESTDIR = $$PWD/../../../../RasterManager/bin/Debug } else{ DESTDIR = $$PWD/../../../../RasterManager/bin/release } INCLUDEPATH += $$PWD/../../../include/gdal1101 DEPENDPATH += $$PWD/../../../include/gdal1101 } else{ CONFIG(debug, debug|release){ DESTDIR = $$PWD/../../../product/release32 } else{ DESTDIR = $$PWD/../../../product/release32 } } # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lUAVAutoRectifyMt -lUAVAutoRectify -lUAVAutoRectifyFi INCLUDEPATH += $$PWD/../include DEPENDPATH += $$PWD/../include unix:!macx: LIBS += -L$$PWD/../../../lib/opencvf249/ -lopencv_core unix:!macx: LIBS += -L$$PWD/../../../lib/opencvf249/ -lopencv_highgui unix:!macx: LIBS += -L$$PWD/../../../lib/opencvf249/ -lopencv_imgproc INCLUDEPATH += $$PWD/../../../lib/opencvf249 DEPENDPATH += $$PWD/../../../lib/opencvf249 unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_core #unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_highgui unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_imgproc unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_features2d unix:!macx: LIBS += -L$$PWD/../../../../../../../usr/local/lib/ -lopencv_imgcodecs INCLUDEPATH += $$PWD/../../../../../../../usr/local/include DEPENDPATH += $$PWD/../../../../../../../usr/local/include unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lDEMDriver unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lProjection unix:!macx: LIBS += -L$$PWD/../../../product/release32/ -lIImage_gC QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO 转为cmake格式
06-11

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

习惯就好zz

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值