diff options
Diffstat (limited to 'src/publisher.c')
| -rw-r--r-- | src/publisher.c | 12 |
1 files changed, 10 insertions, 2 deletions
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 |
