diff --git a/test/main.cpp b/test/main.cpp index 9e3ddb8..6f26584 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -114,7 +114,7 @@ void init_mq_conn(void *handle) { } #endif -const char* ipc_url = "/home/cmhu/tongtu/tsl_aiplatform_project_with_screenshot/data/duan1.avi"; +const char* ipc_url = "/data/cmhu/data2/duan1.avi"; void set_ipc_url(task_param &tparam, const algorithm_type_t &algor_type) { diff --git a/tsl_aiplatform/ai_platform/MultiSourceProcess.cpp b/tsl_aiplatform/ai_platform/MultiSourceProcess.cpp index f0f64f0..7afa99c 100644 --- a/tsl_aiplatform/ai_platform/MultiSourceProcess.cpp +++ b/tsl_aiplatform/ai_platform/MultiSourceProcess.cpp @@ -1280,6 +1280,7 @@ void CMultiSourceProcess::CloseAllTask(){ pthread_join(m_gpuProcessthread,0); + // 待解码线程和算法处理线程都结束后再清理数据队列 m_QueueMtx.lock(); for (auto iter = m_RgbDataList.begin(); iter!=m_RgbDataList.end(); ){ GpuRgbMemory* gpuMem = *iter; diff --git a/tsl_aiplatform/reprocessing_module/save_snapshot_reprocessing.cpp b/tsl_aiplatform/reprocessing_module/save_snapshot_reprocessing.cpp index a6d8b9a..d6cdf6c 100644 --- a/tsl_aiplatform/reprocessing_module/save_snapshot_reprocessing.cpp +++ b/tsl_aiplatform/reprocessing_module/save_snapshot_reprocessing.cpp @@ -34,12 +34,16 @@ save_snapshot_reprocessing::save_snapshot_reprocessing() { _snapshot_reprocessing = snapshot_reprocessing::getInstance(); _task_param_manager = task_param_manager::getInstance(); + bFinish = false; auto m_save_ss_thread = std::thread(save_image_thread_process, this); m_save_ss_thread.detach(); } // 释放资源 void save_snapshot_reprocessing::save_snapshot_reprocessing_release() { + // 结束线程 + bFinish = true; + std::unique_lock l(waitforsave_image_queue_mutex); while (!waitforsave_image_queue.empty()) { @@ -322,6 +326,10 @@ DWORD save_image_thread_process(LPVOID param) { save_snapshot_reprocessing *pThreadParam = (save_snapshot_reprocessing *)param; while (true) { + if (bFinish){ + break; + } + std::unique_lock l(pThreadParam->waitforsave_image_queue_mutex); std::unique_lock l_taskid(pThreadParam->waitforchange_taskid_mutex); if (!pThreadParam->waitforsave_image_queue.empty()) { diff --git a/tsl_aiplatform/reprocessing_module/save_snapshot_reprocessing.h b/tsl_aiplatform/reprocessing_module/save_snapshot_reprocessing.h index f9f6dd7..2432af1 100644 --- a/tsl_aiplatform/reprocessing_module/save_snapshot_reprocessing.h +++ b/tsl_aiplatform/reprocessing_module/save_snapshot_reprocessing.h @@ -82,6 +82,8 @@ public: // map save_snapshot_info_count; // debug by zsh mutable std::mutex waitforchange_taskid_mutex; + bool bFinish{false}; + #ifdef POST_USE_RABBITMQ callback_t callback_; std::shared_ptr rbmq_handler_;