the fifo file for stat output doesn't work. switched back regular file
for stats.
This commit is contained in:
Maurice ONeal 2022-10-02 09:29:29 -04:00
parent 1e72107ff0
commit 42814ab8ca
3 changed files with 9 additions and 20 deletions

View File

@ -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);
}

View File

@ -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 &param, const string &line, string *value);
void rdLine(const string &param, 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);

View File

@ -47,6 +47,8 @@ void detectLoop(shared_t *share)
{
remove(fullPath.c_str());
}
statOut(share);
}
else
{