the crashing issue might be the detection threads going out-of-scope
before properly finishing. re-implemented share->detThreads from
previous stable code to see if this fixes the issue.
This commit is contained in:
Maurice ONeal 2023-02-14 19:29:02 -05:00
parent 4758b62275
commit 4dcd6c05a3
2 changed files with 12 additions and 9 deletions

View File

@ -37,7 +37,7 @@ using namespace cv;
using namespace std; using namespace std;
using namespace std::filesystem; using namespace std::filesystem;
#define APP_VER "1.6.t6" #define APP_VER "1.6.t7"
#define APP_NAME "Motion Watch" #define APP_NAME "Motion Watch"
#define TRIM_REMOVE " \n\r\t\f\v." #define TRIM_REMOVE " \n\r\t\f\v."

View File

@ -96,7 +96,8 @@ void runTOCmds(int timeOut, const vector<string> &cmds, vector<cmdRes_t*> &resLi
res->cmd = cmd; res->cmd = cmd;
res->finished = false; res->finished = false;
res->ret = pthread_create(&res->thr, NULL, &runCmd, res);
pthread_create(&res->thr, NULL, &runCmd, res);
resList.push_back(res); resList.push_back(res);
} }
@ -191,22 +192,24 @@ void recLoop(shared_t *share)
runTOCmds(share->clipLen, cmds, rets); runTOCmds(share->clipLen, cmds, rets);
for (auto &&ret : rets)
{
recLog("cmd: " + ret->cmd + " return_code: " + to_string(ret->ret), share);
}
if (allCmdsDidNotFail(rets)) if (allCmdsDidNotFail(rets))
{ {
new thread(detectMoInFile, detPath, recPath, share); share->detThreads.push_back(thread(detectMoInFile, detPath, recPath, share));
} }
else else
{ {
recLog("one or both fetch cmds failed.", share); recLog("one or both fetch cmds failed.", share);
} }
recLog("fetch results:", share); cleanupRes(rets);
}
for (auto &&ret : rets) waitForDetThreads(share);
{
recLog("cmd: " + ret->cmd + " return_code: " + to_string(ret->ret), share);
}
}
if (!share->skipCmd) if (!share->skipCmd)
{ {