diff options
| author | Loic Guegan <loic.guegan@mailbox.org> | 2023-09-12 16:03:31 +0200 |
|---|---|---|
| committer | Loic Guegan <loic.guegan@mailbox.org> | 2023-09-12 16:03:31 +0200 |
| commit | 6d3e13df8e91eb3d0d784304540af696f1242d98 (patch) | |
| tree | e6caa0f8db703d567ed6c55966931919e96618d7 /src | |
| parent | f4a3b66017b2800a3b1b3baccf1fc7cc204bb4e7 (diff) | |
Minor changes
Diffstat (limited to 'src')
| -rw-r--r-- | src/publisher.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/publisher.c b/src/publisher.c index f6e173a..1df2f88 100644 --- a/src/publisher.c +++ b/src/publisher.c @@ -17,6 +17,7 @@ /// @brief Set to non-zero to stop the processes unsigned char __stop = 0; +unsigned char __stop_zmq_thread = 0; /** * @brief Stop process properly on SIGINT @@ -144,6 +145,7 @@ int main(int argc, char *argv[]) { //----- Cleaning close(regfd); + __stop_zmq_thread=1; // Ignite clean stop pthread_join(zmq_thread, NULL); zmq_close(zmq_publisher); zmq_ctx_destroy(zmq_context); @@ -153,7 +155,9 @@ int main(int argc, char *argv[]) { void *publisher(void *zmq_publisher) { int queue_id = 0; - while (!__stop) { + while (1) { + if(__stop_zmq_thread && !queues[queue_id].issending) + break; if (queues[queue_id].issending) { long long startat=TIMESTAMP(); printf("Publishing..."); |
