aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2009-12-02 23:13:45 +0000
committerDimitri Sokolyuk <demon@dim13.org>2009-12-02 23:13:45 +0000
commit123a13a1b8ce6b9e8c31f4d09e04d3ca7cac674b (patch)
tree43b6d0044d3ab286b68a17f4350341a6276c3cd8
parent398df06131e78e3198fd652d83acea23d22b902d (diff)
add dontstop flag
-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++)