aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/integration.c32
-rw-r--r--libcrystfel/src/integration.h4
2 files changed, 18 insertions, 18 deletions
diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c
index 336e99ed..16c27bbe 100644
--- a/libcrystfel/src/integration.c
+++ b/libcrystfel/src/integration.c
@@ -38,7 +38,6 @@
#include <gsl/gsl_vector.h>
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_eigen.h>
-#include <semaphore.h>
#ifdef HAVE_CURSES_COLOR
#include <ncurses.h>
@@ -253,14 +252,14 @@ static void show_reference_profile(struct intcontext *ic, int i)
static void show_peak_box(struct intcontext *ic, struct peak_box *bx,
- sem_t *term_sem)
+ pthread_mutex_t *term_lock)
{
#ifdef HAVE_CURSES_COLOR
int q;
signed int h, k, l;
double fs, ss;
- if ( term_sem != NULL ) sem_wait(term_sem);
+ if ( term_lock != NULL ) pthread_mutex_lock(term_lock);
initscr();
clear();
@@ -324,7 +323,7 @@ static void show_peak_box(struct intcontext *ic, struct peak_box *bx,
getch();
endwin();
- if ( term_sem != NULL ) sem_post(term_sem);
+ if ( term_lock != NULL ) pthread_mutex_unlock(term_lock);
#else
STATUS("Not showing peak box because CrystFEL was compiled without "
"ncurses.\n");
@@ -1171,7 +1170,7 @@ static int get_int_diag(struct intcontext *ic, Reflection *refl)
static void integrate_prof2d_once(struct intcontext *ic, struct peak_box *bx,
- sem_t *sem)
+ pthread_mutex_t *term_lock)
{
bx->intensity = fit_intensity(ic, bx);
bx->sigma = calc_sigma(ic, bx);
@@ -1201,7 +1200,9 @@ static void integrate_prof2d_once(struct intcontext *ic, struct peak_box *bx,
set_redundancy(bx->refl, 0);
}
- if ( get_int_diag(ic, bx->refl) ) show_peak_box(ic, bx, sem);
+ if ( get_int_diag(ic, bx->refl) ) {
+ show_peak_box(ic, bx, term_lock);
+ }
} else {
@@ -1294,7 +1295,7 @@ static void integrate_prof2d(IntegrationMethod meth,
Crystal *cr, struct image *image, IntDiag int_diag,
signed int idh, signed int idk, signed int idl,
double ir_inn, double ir_mid, double ir_out,
- sem_t *term_sem, int **masks)
+ pthread_mutex_t *term_lock, int **masks)
{
RefList *list;
UnitCell *cell;
@@ -1338,7 +1339,7 @@ static void integrate_prof2d(IntegrationMethod meth,
for ( i=0; i<ic.n_boxes; i++ ) {
struct peak_box *bx;
bx = &ic.boxes[i];
- integrate_prof2d_once(&ic, bx, term_sem);
+ integrate_prof2d_once(&ic, bx, term_lock);
}
//refine_rigid_groups(&ic);
@@ -1351,7 +1352,7 @@ static void integrate_prof2d(IntegrationMethod meth,
static void integrate_rings_once(Reflection *refl, struct image *image,
struct intcontext *ic, UnitCell *cell,
- sem_t *term_sem)
+ pthread_mutex_t *term_lock)
{
double pfs, pss;
struct peak_box *bx;
@@ -1450,7 +1451,7 @@ static void integrate_rings_once(Reflection *refl, struct image *image,
pss += bx->offs_ss;
set_detector_pos(refl, pfs, pss);
- if ( get_int_diag(ic, refl) ) show_peak_box(ic, bx, term_sem);
+ if ( get_int_diag(ic, refl) ) show_peak_box(ic, bx, term_lock);
if ( intensity < -5.0*sigma ) {
ic->n_implausible++;
@@ -1550,7 +1551,7 @@ static void integrate_rings(IntegrationMethod meth,
Crystal *cr, struct image *image, IntDiag int_diag,
signed int idh, signed int idk, signed int idl,
double ir_inn, double ir_mid, double ir_out,
- sem_t *term_sem, int **masks)
+ pthread_mutex_t *term_lock, int **masks)
{
RefList *list;
Reflection *refl;
@@ -1586,7 +1587,7 @@ static void integrate_rings(IntegrationMethod meth,
refl != NULL;
refl = next_refl(refl, iter) )
{
- integrate_rings_once(refl, image, &ic, cell, term_sem);
+ integrate_rings_once(refl, image, &ic, cell, term_lock);
}
//refine_rigid_groups(&ic);
@@ -1602,7 +1603,8 @@ void integrate_all_4(struct image *image, IntegrationMethod meth,
PartialityModel pmodel, double push_res,
double ir_inn, double ir_mid, double ir_out,
IntDiag int_diag,
- signed int idh, signed int idk, signed int idl, sem_t *sem)
+ signed int idh, signed int idk, signed int idl,
+ pthread_mutex_t *term_lock)
{
int i;
int *masks[image->det->n_panels];
@@ -1642,14 +1644,14 @@ void integrate_all_4(struct image *image, IntegrationMethod meth,
integrate_rings(meth, cr, image,
int_diag, idh, idk, idl,
ir_inn, ir_mid, ir_out,
- sem, masks);
+ term_lock, masks);
break;
case INTEGRATION_PROF2D :
integrate_prof2d(meth, cr, image,
int_diag, idh, idk, idl,
ir_inn, ir_mid, ir_out,
- sem, masks);
+ term_lock, masks);
break;
default :
diff --git a/libcrystfel/src/integration.h b/libcrystfel/src/integration.h
index 7414f818..a012fc14 100644
--- a/libcrystfel/src/integration.h
+++ b/libcrystfel/src/integration.h
@@ -33,8 +33,6 @@
#include <config.h>
#endif
-#include <semaphore.h>
-
#include "geometry.h"
/**
@@ -128,7 +126,7 @@ extern void integrate_all_4(struct image *image, IntegrationMethod meth,
double ir_inn, double ir_mid, double ir_out,
IntDiag int_diag,
signed int idh, signed int idk, signed int idl,
- sem_t *term_sem);
+ pthread_mutex_t *term_lock);
#ifdef __cplusplus