From 72d6ef9ec6893f98630e46c70cf8cefba4c4fa80 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Fri, 2 Feb 2024 13:17:07 +0100 Subject: Minor changes --- src/publisher.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/publisher.c') diff --git a/src/publisher.c b/src/publisher.c index db93e63..309cf6b 100644 --- a/src/publisher.c +++ b/src/publisher.c @@ -37,7 +37,13 @@ void sighandler(int signo) { void *publisher(void *zmq_publisher); void askforbreak(){ - + FILE * file; + file = fopen(__break_file, "r"); + while(file){ + usleep(BREAK_DURATION * 1000); + fclose(file); + file = fopen(__break_file, "r"); + } } typedef struct queue { @@ -70,7 +76,7 @@ int main(int argc, char *argv[]) { strcat(regpower, INA260_POWER_OUTPUT); // __break_file - strcat(__break_file, "/publisher_"); + strcat(__break_file, "publisher_"); strcat(__break_file, key); strcat(__break_file, "_break"); printf("%s\n",__break_file); @@ -116,6 +122,8 @@ int main(int argc, char *argv[]) { //----- Start logging printf("Logger started [client=%s,interval=%ds]\n", client, loginterval); while (!__stop) { + // Check whether logging must be stopped + askforbreak(); // Busy wait: while (queues[queue_id].issending) {} // Get current interval -- cgit v1.2.3