aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--weasel.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/weasel.c b/weasel.c
index 809cc97..8f73d40 100644
--- a/weasel.c
+++ b/weasel.c
@@ -247,11 +247,12 @@ main(int argc, char **argv)
pthread_t *threads;
int i, c, n, nthreads;
int display = 1;
+ int dontstop = 0;
alphabet = defalpha;
nthreads = ncpu();
- while ((c = getopt(argc, argv, "a:m:np:t:")) != -1)
+ while ((c = getopt(argc, argv, "a:m:np:st:")) != -1)
switch (c) {
case 'a':
alphabet = strdup(optarg);
@@ -271,6 +272,9 @@ main(int argc, char **argv)
usage();
population = i;
break;
+ case 's':
+ dontstop = 1;
+ break;
case 't':
i = atoi(optarg);
if (i <= 0)
@@ -298,7 +302,7 @@ main(int argc, char **argv)
pthread_attr_init(&attr);
// pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- for (i = 0; !success(&best); i++) {
+ for (i = 0; !success(&best) || dontstop; i++) {
for (n = 0; n < nthreads; n++)
pthread_create(&threads[n], &attr, intercourse, NULL);
for (n = 0; n < nthreads; n++)