+ return ((void *) 0);
+} /* int start_evolution */
+
+static int evolution_start (int threads_num)
+{
+ pthread_t threads[threads_num]; /* C99 ftw! */
+ int i;
+
+ for (i = 0; i < threads_num; i++)
+ {
+ int status;
+
+ status = pthread_create (&threads[i], /* attr = */ NULL,
+ evolution_thread, /* arg = */ NULL);
+ if (status != 0)
+ {
+ fprintf (stderr, "evolution_start: pthread_create[%i] failed "
+ "with status %i.\n",
+ i, status);
+ threads[i] = 0;
+ }
+ }
+
+ while (do_loop == 0)
+ {
+ int status;
+
+ status = sleep (1);
+ if (status == 0)
+ {
+ sn_network_t *n;
+ int stages_num;
+ int comparators_num;
+ int rating;
+ int iter;
+
+ iter = iteration_counter;
+
+ n = population_get_fittest (population);
+
+ rating = rate_network (n);
+
+ stages_num = SN_NETWORK_STAGE_NUM (n);
+ comparators_num = 0;
+ for (i = 0; i < stages_num; i++)
+ {
+ sn_stage_t *s;
+
+ s = SN_NETWORK_STAGE_GET (n, i);
+ comparators_num += SN_STAGE_COMP_NUM (s);
+ }
+
+ sn_network_destroy (n);
+
+ printf ("Best after approximately %i iterations: "
+ "%i comparators in %i stages. Rating: %i.\n",
+ iter, comparators_num, stages_num, rating);
+ }
+ }
+
+ for (i = 0; i < threads_num; i++)
+ {
+ if (threads[i] == 0)
+ continue;
+ pthread_join (threads[i], /* value_ptr = */ NULL);