aboutsummaryrefslogtreecommitdiff
path: root/src/im-sandbox.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/im-sandbox.h')
-rw-r--r--src/im-sandbox.h39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/im-sandbox.h b/src/im-sandbox.h
index 235825ce..67bc88c8 100644
--- a/src/im-sandbox.h
+++ b/src/im-sandbox.h
@@ -3,13 +3,13 @@
*
* Sandbox for indexing
*
- * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY,
+ * Copyright © 2012-2015 Deutsches Elektronen-Synchrotron DESY,
* a research centre of the Helmholtz Association.
* Copyright © 2012 Richard Kirian
* Copyright © 2012 Lorenzo Galli
*
* Authors:
- * 2010-2014 Thomas White <taw@physics.org>
+ * 2010-2015 Thomas White <taw@physics.org>
* 2011 Richard Kirian
* 2012 Lorenzo Galli
* 2012 Chunhong Yoon
@@ -31,11 +31,46 @@
*
*/
+#ifndef IM_SANDBOX_H
+#define IM_SANDBOX_H
+
+#include <semaphore.h>
+
+struct sb_shm;
+
#include "index.h"
#include "stream.h"
#include "cell.h"
#include "process_image.h"
+/* Length of event queue */
+#define QUEUE_SIZE (256)
+
+/* Maximum length of an event ID including serial number */
+#define MAX_EV_LEN (1024)
+
+/* Maximum number of workers */
+#define MAX_NUM_WORKERS (1024)
+
+struct sb_shm
+{
+ pthread_mutex_t term_lock;
+
+ pthread_mutex_t queue_lock;
+ int n_events;
+ char queue[QUEUE_SIZE][MAX_EV_LEN];
+ int no_more;
+ char last_ev[MAX_NUM_WORKERS][MAX_EV_LEN];
+ sem_t queue_sem;
+
+ pthread_mutex_t totals_lock;
+ int n_processed;
+ int n_hadcrystals;
+ int n_crystals;
+};
+
extern void create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
int config_basename, FILE *fh, Stream *stream,
const char *tempdir);
+
+#endif /* IM_SANDBOX_H */