diff options
Diffstat (limited to 'src/partial_sim.c')
-rw-r--r-- | src/partial_sim.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/partial_sim.c b/src/partial_sim.c index 9e054675..3cfb94a2 100644 --- a/src/partial_sim.c +++ b/src/partial_sim.c @@ -189,6 +189,7 @@ struct queue_args pthread_mutex_t full_lock; int n_done; + int n_started; int n_to_do; SymOpList *sym; @@ -225,11 +226,16 @@ static void *create_job(void *vqargs) struct worker_args *wargs; struct queue_args *qargs = vqargs; + /* All done already? */ + if ( qargs->n_started == qargs->n_to_do ) return NULL; + wargs = malloc(sizeof(struct worker_args)); wargs->qargs = qargs; wargs->image = *qargs->template_image; + qargs->n_started++; + return wargs; } @@ -482,7 +488,7 @@ int main(int argc, char *argv[]) } if ( output_file == NULL ) { - ERROR("You must pgive a filename for the output.\n"); + ERROR("You must give a filename for the output.\n"); return 1; } ofh = fopen(output_file, "w"); @@ -512,6 +518,7 @@ int main(int argc, char *argv[]) pthread_mutex_init(&qargs.full_lock, NULL); qargs.n_to_do = n; qargs.n_done = 0; + qargs.n_started = 0; qargs.sym = sym; qargs.random_intensities = random_intensities; qargs.cell = cell; |