派生自 development/c++

pansen
2019-03-06 a2dfb4907fd11e0a64ba16419dce066509462297
QiaoJiaSystem/VideoAnalysFromHC/BaiscSDKAnalysVideo.h
@@ -23,38 +23,38 @@
    using TASK_FUNCTION = std::function<void(std::shared_ptr<finishSdkHdlManage> &, int)>;
public:
    BaiscSDKAnalysVideo(TASK_FUNCTION task_f = nullptr) : m_task_function(task_f) {
        resetFdfs();
        {
            std::thread httpServer([&]() {
                HttpSrvRetRecieve httpSrvRetRecieve("0.0.0.0", 9090, 1);
                httpSrvRetRecieve.setInfo("^/resetFdfs$", "POST", std::bind(&BaiscSDKAnalysVideo::resetFdfs, this,
                                                                            std::placeholders::_1,
                                                                            std::placeholders::_2,
                                                                            std::placeholders::_3));
                httpSrvRetRecieve.start();
                httpSrvRetRecieve.waitForShutDown();
            });
            httpServer.detach();
        }
//        resetFdfs();
//        {
//            std::thread httpServer([&]() {
//                HttpSrvRetRecieve httpSrvRetRecieve("0.0.0.0", 9090, 1);
//                httpSrvRetRecieve.setInfo("^/resetFdfs$", "POST", std::bind(&BaiscSDKAnalysVideo::resetFdfs, this,
//                                                                            std::placeholders::_1,
//                                                                            std::placeholders::_2,
//                                                                            std::placeholders::_3));
//                httpSrvRetRecieve.start();
//                httpSrvRetRecieve.waitForShutDown();
//            });
//            httpServer.detach();
//        }
    }
    ~BaiscSDKAnalysVideo() {
    }
    std::string resetFdfs(std::string ip = "", unsigned int port = 0, std::string content = "") {
        std::thread reset([&]() {
            fdfsClient.rwLock.rdlock();
            if (fdfsClient.fastFds != nullptr) {
                delete fdfsClient.fastFds;
            }
            fdfsClient.fastFds = new FastFds("fastDfsClient.conf");
            fdfsClient.rwLock.unlock();
        });
        reset.detach();
        return "";
    }
//    std::string resetFdfs(std::string ip = "", unsigned int port = 0, std::string content = "") {
//
//        std::thread reset([&]() {
//            fdfsClient.rwLock.rdlock();
//            if (fdfsClient.fastFds != nullptr) {
//                delete fdfsClient.fastFds;
//            }
//            fdfsClient.fastFds = new FastFds("fastDfsClient.conf");
//            fdfsClient.rwLock.unlock();
//        });
//        reset.detach();
//
//        return "";
//    }
private:
    virtual void doFunc(std::shared_ptr<getsdkHdlManage> spPacket) {