From 5fe85da2effa4cef08ab495e69347096a50cef9c Mon Sep 17 00:00:00 2001 From: zenon Date: Thu, 7 Jun 2018 10:33:42 +0200 Subject: [PATCH] Loop until supervisor exits --- generator.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/generator.c b/generator.c index 7e9142a..886d57b 100644 --- a/generator.c +++ b/generator.c @@ -303,24 +303,24 @@ int main(int argc, char *argv[]) int permutation[graph.V]; while (quit == 0) { - for (int i = 0; i < 10000000; i++) { - int solution[MAX_ITEMS]; - genSolution(permutation, graph.V, solution); - printf("["); - if (solution[0] == -1) { - printf("]\n"); - break; - } - int j; - for (j = 0; j < (MAX_ITEMS - 1); j++) { - if (solution[j+1] != -1) - printf("%d, ", solution[j]); - else - break; - } - printf("%d]\n", solution[j]); + if (shared->quit == 1) + break; + + int solution[MAX_ITEMS]; + genSolution(permutation, graph.V, solution); + printf("["); + if (solution[0] == -1) { + printf("]\n"); + break; } - break; + int j; + for (j = 0; j < (MAX_ITEMS - 1); j++) { + if (solution[j+1] != -1) + printf("%d, ", solution[j]); + else + break; + } + printf("%d]\n", solution[j]); } cleanup();