v3.0.t16
-added mutex thread protection. getting sigmentation faults on the test machine. added thread protection on various shared parameters in hope that it fix the random crashing issue.
This commit is contained in:
parent
51218198b5
commit
09a0f030ac
|
@ -248,8 +248,10 @@ bool Upkeep::exec()
|
|||
dumpLogs(QString("logs/") + REC_LOG_NAME, shared->recLog);
|
||||
dumpLogs(QString("logs/") + DET_LOG_NAME, shared->detLog);
|
||||
|
||||
shared->logMutex.lock();
|
||||
shared->recLog.clear();
|
||||
shared->detLog.clear();
|
||||
shared->logMutex.unlock();
|
||||
|
||||
initLogFrontPages();
|
||||
enforceMaxEvents(shared);
|
||||
|
@ -308,6 +310,8 @@ bool EventLoop::exec()
|
|||
|
||||
while (!shared->recList.isEmpty())
|
||||
{
|
||||
shared->recMutex.lock();
|
||||
|
||||
auto event = shared->recList[0];
|
||||
auto maxFiles = shared->evMaxSecs / 2;
|
||||
// there's 2 secs in each hls segment
|
||||
|
@ -324,6 +328,7 @@ bool EventLoop::exec()
|
|||
vidList.append(forwardFacingFiles("live", ".ts", event.timeStamp, maxFiles / 2));
|
||||
|
||||
shared->recList.removeFirst();
|
||||
shared->recMutex.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -494,7 +499,9 @@ bool DetectLoop::exec()
|
|||
event.score = score;
|
||||
event.imgPath = images[pos];
|
||||
|
||||
shared->recMutex.lock();
|
||||
shared->recList.append(event); mod = true;
|
||||
shared->recMutex.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,10 +25,11 @@
|
|||
#include <QThread>
|
||||
#include <QTimer>
|
||||
#include <QStringList>
|
||||
#include <QMutex>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define APP_VER "3.0.t15"
|
||||
#define APP_VER "3.0.t16"
|
||||
#define APP_NAME "Motion Watch"
|
||||
#define APP_BIN "mow"
|
||||
#define REC_LOG_NAME "rec_log_lines.html"
|
||||
|
@ -49,6 +50,8 @@ struct evt_t
|
|||
struct shared_t
|
||||
{
|
||||
QList<evt_t> recList;
|
||||
QMutex recMutex;
|
||||
QMutex logMutex;
|
||||
QString conf;
|
||||
QString recLog;
|
||||
QString detLog;
|
||||
|
|
|
@ -14,12 +14,20 @@
|
|||
|
||||
void recLog(const QString &line, shared_t *share)
|
||||
{
|
||||
share->logMutex.lock();
|
||||
|
||||
share->recLog += QDateTime::currentDateTime().toString("[yyyy-MM-dd-hh-mm-ss] ") + line + "<br>\n";
|
||||
|
||||
share->logMutex.unlock();
|
||||
}
|
||||
|
||||
void detLog(const QString &line, shared_t *share)
|
||||
{
|
||||
share->logMutex.lock();
|
||||
|
||||
share->detLog += QDateTime::currentDateTime().toString("[yyyy-MM-dd-hh-mm-ss] ") + line + "<br>\n";
|
||||
|
||||
share->logMutex.unlock();
|
||||
}
|
||||
|
||||
void enforceMaxLogSize(const QString &filePath, shared_t *share)
|
||||
|
|
Loading…
Reference in New Issue
Block a user