diff options
| author | Loic Guegan <loic.guegan@mailbox.org> | 2024-02-02 13:17:07 +0100 |
|---|---|---|
| committer | Loic Guegan <loic.guegan@mailbox.org> | 2024-02-02 13:17:07 +0100 |
| commit | 72d6ef9ec6893f98630e46c70cf8cefba4c4fa80 (patch) | |
| tree | ff6675e4c87aa91e981bc66880839b3e9ed54314 /src/publisher.c | |
| parent | 1e8c15ca87a6df0305396dacc267ba65d28c8631 (diff) | |
Minor changes
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 |
