aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-01-12 14:24:55 +0100
committerThomas White <taw@physics.org>2017-01-12 14:25:28 +0100
commit7dbbfa426b1569ebac2fcea8d74306db09fa5bcb (patch)
treead7cf4e51a827404e7812a004ce1b1671f6a4620 /src
parent25418e68b5ba3ead044aaf4eed12eff51d65cb92 (diff)
indexamajig: Fix hanging on "Waiting for last patterns"
Diffstat (limited to 'src')
-rw-r--r--src/im-sandbox.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index 51cd5903..979fc136 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -3,13 +3,13 @@
*
* Sandbox for indexing
*
- * Copyright © 2012-2016 Deutsches Elektronen-Synchrotron DESY,
+ * Copyright © 2012-2017 Deutsches Elektronen-Synchrotron DESY,
* a research centre of the Helmholtz Association.
* Copyright © 2012 Richard Kirian
* Copyright © 2012 Lorenzo Galli
*
* Authors:
- * 2010-2016 Thomas White <taw@physics.org>
+ * 2010-2017 Thomas White <taw@physics.org>
* 2014 Valerio Mariani
* 2011 Richard Kirian
* 2012 Lorenzo Galli
@@ -73,10 +73,17 @@ struct sandbox
struct index_args *iargs;
+ /* Worker processes */
int n_proc;
pid_t *pids;
-
int *running;
+ time_t *last_response;
+
+ /* Streams to read from (NB not the same indices as the above) */
+ int n_read;
+ FILE **fhs;
+ int *fds;
+
int serial;
struct sb_shm *shared;
@@ -84,14 +91,6 @@ struct sandbox
char *tmpdir;
- /* The last time each worker was heard from */
- time_t *last_response;
-
- /* Streams to read from */
- int n_read;
- FILE **fhs;
- int *fds;
-
/* Final output */
Stream *stream;
};
@@ -131,7 +130,7 @@ static void check_hung_workers(struct sandbox *sb)
{
int i;
time_t tnow = get_monotonic_seconds();
- for ( i=0; i<sb->n_read; i++ ) {
+ for ( i=0; i<sb->n_proc; i++ ) {
if ( !sb->running[i] ) continue;
if ( tnow - sb->last_response[i] > 240 ) {
STATUS("Worker %i did not respond for 240 seconds - "