From 17b3b7432e5e04f2171308796cdb72a5dd919919 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sun, 30 Apr 2017 20:22:28 +1200 Subject: Relocate variable declaration to top of main --- sand-leek.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sand-leek.c b/sand-leek.c index 130d322..6cf5174 100644 --- a/sand-leek.c +++ b/sand-leek.c @@ -228,6 +228,7 @@ int main(int argc, char **argv) { int opt = '\0'; int thread_count = 1; + int loops = 0; int i = 0; size_t offset = 0; pthread_t *workers = NULL; @@ -285,8 +286,8 @@ main(int argc, char **argv) { } } - int loops = 0; /* workers started; wait on one to finish */ + loops = 0; while (sem_trywait(&working) && errno == EAGAIN) { sleep(1); loops++; -- cgit v1.1