zoukankan      html  css  js  c++  java
  • 第32月第30天 runloop阻塞线程 超时 cmake

    1. runloop阻塞线程 超时

    bool CvCaptureCAM::grabFrame(double timeOut) {
    
        NSAutoreleasePool* localpool = [[NSAutoreleasePool alloc] init];
        double sleepTime = 0.005;
        double total = 0;
    
        // If the capture is launched in a separate thread, then
        // [NSRunLoop currentRunLoop] is not the same as in the main thread, and has no timer.
        //see https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/nsrunloop_Class/Reference/Reference.html
        // "If no input sources or timers are attached to the run loop, this
        // method exits immediately"
        // using usleep() is not a good alternative, because it may block the GUI.
        // Create a dummy timer so that runUntilDate does not exit immediately:
        [NSTimer scheduledTimerWithTimeInterval:100 target:nil selector:@selector(doFireTimer:) userInfo:nil repeats:YES];
        while (![capture updateImage] && (total += sleepTime)<=timeOut) {
            [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:sleepTime]];
        }
    
        [localpool drain];
    
        return total <= timeOut;
    }

     2.cmake

    、cmake编译

    cd opencv-3.4.1
    mkdir build
    cd build
    
    # 注意,下面是一条指令,部分环境下可能显示成两行,看起来像两行
    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/pascal/software/opencv341 ..
    

    得到结果

    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/pascal/downloads/opencv-3.4.1/build
    

    4、make编译

    make
  • 相关阅读:
    centos和ubuntu配置路由的三种方式
    程序包编译安装
    逻辑卷磁盘管理和dd命令
    linux磁盘管理
    CDOJ 1269 ZhangYu Speech 数组处理
    poj 2236 Wireless Network 并查集
    poj 1182 食物链 并查集
    POJ 2109 Power of Cryptography 数学题 double和float精度和范围
    CDOJ 1264 人民币的构造 区间问题+数论
    CDOJ 1263 The Desire of Asuna 贪心
  • 原文地址:https://www.cnblogs.com/javastart/p/10949069.html
Copyright © 2011-2022 走看看