aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/facetron.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/facetron.c b/src/facetron.c
index 55acb645..bd7f58ed 100644
--- a/src/facetron.c
+++ b/src/facetron.c
@@ -99,9 +99,6 @@ static void integrate_image(struct process_args *pargs)
struct hdfile *hdfile;
struct image *image = pargs->image;
- image->data = NULL;
- image->flags = NULL;
-
hdfile = hdfile_open(image->filename);
if ( hdfile == NULL ) {
ERROR("Couldn't open '%s'\n", image->filename);
@@ -118,8 +115,6 @@ static void integrate_image(struct process_args *pargs)
return;
}
-goto skip;
-
/* Figure out which spots should appear in this pattern,
* using a large divergence and bandwidth to avoid missing
* reflection tails. */
@@ -161,11 +156,14 @@ goto skip;
}
-skip:
free(image->data);
if ( image->flags != NULL ) free(image->flags);
hdfile_close(hdfile);
- //free(spots);
+ free(spots);
+
+ /* Muppet proofing */
+ image->data = NULL;
+ image->flags = NULL;
}
@@ -178,6 +176,11 @@ static void *worker_thread(void *pargsv)
int wakeup;
+ /* Acknowledge start */
+ pthread_mutex_lock(&pargs->control_mutex);
+ pargs->start = 0;
+ pthread_mutex_unlock(&pargs->control_mutex);
+
pargs->func(pargs);
pthread_mutex_lock(&pargs->control_mutex);
@@ -279,7 +282,9 @@ static void munch_threads(struct image *images, int n_total_patterns,
if ( !done ) continue;
/* Reset "done" flag */
+ pthread_mutex_lock(&pargs->control_mutex);
pargs->done = 0;
+ pthread_mutex_unlock(&pargs->control_mutex);
n_done++;
progress_bar(n_done, n_total_patterns, text);
@@ -530,6 +535,10 @@ int main(int argc, char *argv[])
images[i].orientation.z = 0.0;
images[i].det = det;
+ /* Muppet proofing */
+ images[i].data = NULL;
+ images[i].flags = NULL;
+
free(filename);
progress_bar(i, n_total_patterns-1, "Loading pattern data");