From 1323549a8a6d9b15f4415f7fe3b5baaa91292630 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Mon, 29 Nov 2010 20:15:40 +0100 Subject: [PATCH] Increase count only at one place --- latester/latester.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/latester/latester.c b/latester/latester.c index e32f960..8d38540 100644 --- a/latester/latester.c +++ b/latester/latester.c @@ -371,10 +371,11 @@ void *measure_thread(void *arg) set_sched_policy_and_prio(SCHED_FIFO, 99); #define SEND() \ - do { printf("send\n"); \ + do { printf("send\n"); \ ret = send_frame(pfd[0].fd); \ if (ret != sizeof(struct can_frame)) \ - error(1, errno, "send_frame"); \ + error(1, errno, "send_frame %d", __LINE__); \ + count++; \ msg_in_progress++; \ } while (0) @@ -398,7 +399,7 @@ void *measure_thread(void *arg) break; case 0: // Timeout if (opt.period_us) { - if (opt.count == 0 || count++ < opt.count) { + if (opt.count == 0 || count < opt.count) { SEND(); } else { error(1, 0, "poll timeout"); @@ -410,7 +411,7 @@ void *measure_thread(void *arg) process_tx(pfd[0].fd); } if (pfd[0].revents & POLLOUT) { - if (opt.count == 0 || count++ < opt.count) + if (opt.count == 0 || count < opt.count) SEND(); } pfd[0].revents = 0; @@ -425,7 +426,7 @@ void *measure_thread(void *arg) process_final_rx(pfd[i].fd); msg_in_progress--; pfd[i].revents = 0; - if ((opt.count == 0 || count++ < opt.count) && + if ((opt.count == 0 || count < opt.count) && opt.oneattime) { SEND(); } -- 2.39.2