From 42814ab8ca10d4ce098531524f38d7a2df5d24fa Mon Sep 17 00:00:00 2001 From: Maurice ONeal Date: Sun, 2 Oct 2022 09:29:29 -0400 Subject: [PATCH] v1.4.t7 the fifo file for stat output doesn't work. switched back regular file for stats. --- src/common.cpp | 23 +++++------------------ src/common.h | 4 ++-- src/main.cpp | 2 ++ 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/common.cpp b/src/common.cpp index ede1a72..74d4588 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -262,8 +262,6 @@ bool rdConf(shared_t *share) remove_all(share->buffDir.c_str()); share->init = false; - - new thread(statFifo, share); } new thread(enforceMaxDays, share); @@ -336,24 +334,13 @@ string parseForParam(const string &arg, int argc, char** argv, bool argOnly) return string(); } -void statFifo(shared_t *share) +void statOut(shared_t *share) { createDirTree(cleanDir(share->buffDir)); - auto path = string(cleanDir(share->buffDir) + "/stat"); - auto newLine = string("\n"); + auto path = string(cleanDir(share->buffDir) + "/stat"); + auto fd = open(path.c_str(), O_WRONLY); - if (!fileExists(path)) - { - mkfifo(path.c_str(), 0666); - } - - while (true) - { - auto fd = open(path.c_str(), O_WRONLY); - - write(fd, newLine.c_str(), newLine.size() + 1); - write(fd, share->stat.c_str(), share->stat.size() + 1); - close(fd); - } + write(fd, share->stat.c_str(), share->stat.size() + 1); + close(fd); } diff --git a/src/common.h b/src/common.h index af983e5..72c2b42 100644 --- a/src/common.h +++ b/src/common.h @@ -37,7 +37,7 @@ using namespace std; using namespace std::filesystem; #define BUF_SZ 10 -#define APP_VER "1.4.t6" +#define APP_VER "1.4.t7" struct shared_t { @@ -79,7 +79,7 @@ void replaceAll(string &str, const string &from, const string &to); void enforceMaxDays(shared_t *share); void rdLine(const string ¶m, const string &line, string *value); void rdLine(const string ¶m, const string &line, int *value); -void statFifo(shared_t *share); +void statOut(shared_t *share); bool rdConf(shared_t *share); bool capPair(Mat &prev, Mat &next, VideoCapture &capture, shared_t *share); Mat toGray(const Mat &src); diff --git a/src/main.cpp b/src/main.cpp index 98b8f5f..4a6f77f 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -47,6 +47,8 @@ void detectLoop(shared_t *share) { remove(fullPath.c_str()); } + + statOut(share); } else {