mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
merge from develpoer, locking complete set of start acq steps and stop steps in eiger server as it shouldnt be interrutped, moved prepare into startstatemachine (#577)
This commit is contained in:
@ -25,4 +25,6 @@ int sharedMemory_getScanStop();
|
||||
#ifdef EIGERD
|
||||
void sharedMemory_lockLocalLink();
|
||||
void sharedMemory_unlockLocalLink();
|
||||
void sharedMemory_lockAcqFlag();
|
||||
void sharedMemory_unlockAcqFlag();
|
||||
#endif
|
@ -652,9 +652,6 @@ int setTransmissionDelayRight(int value);
|
||||
#endif
|
||||
|
||||
// aquisition
|
||||
#ifdef EIGERD
|
||||
int prepareAcquisition();
|
||||
#endif
|
||||
int startStateMachine();
|
||||
#ifdef VIRTUAL
|
||||
void *start_timer(void *arg);
|
||||
|
@ -20,6 +20,7 @@ typedef struct Memory {
|
||||
pthread_mutex_t lockStatus;
|
||||
#ifdef EIGERD
|
||||
pthread_mutex_t lockLocalLink;
|
||||
pthread_mutex_t lockAcqFlag;
|
||||
#endif
|
||||
enum runStatus scanStatus; // idle, running or error
|
||||
int scanStop;
|
||||
@ -120,6 +121,7 @@ int sharedMemory_initialize() {
|
||||
#endif
|
||||
|
||||
#ifdef EIGERD
|
||||
// local link mutex
|
||||
pthread_mutexattr_t lockLocalLinkAttribute;
|
||||
if (pthread_mutexattr_init(&lockLocalLinkAttribute) != 0) {
|
||||
LOG(logERROR,
|
||||
@ -141,6 +143,28 @@ int sharedMemory_initialize() {
|
||||
"shared memory\n"));
|
||||
return FAIL;
|
||||
}
|
||||
// acq flag mutex
|
||||
pthread_mutexattr_t lockAcqFlagAttribute;
|
||||
if (pthread_mutexattr_init(&lockAcqFlagAttribute) != 0) {
|
||||
LOG(logERROR,
|
||||
("Failed to initialize mutex attribute for lockAcqFlag for "
|
||||
"shared memory\n"));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if (pthread_mutexattr_setpshared(&lockAcqFlagAttribute,
|
||||
PTHREAD_PROCESS_SHARED) != 0) {
|
||||
LOG(logERROR, ("Failed to set attribute property to process shared for "
|
||||
"lockAcqFlag for shared memory\n"));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if (pthread_mutex_init(&(shm->lockAcqFlag), &lockAcqFlagAttribute) !=
|
||||
0) {
|
||||
LOG(logERROR, ("Failed to initialize pthread_mutex_t lockAcqFlag for "
|
||||
"shared memory\n"));
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
shm->scanStatus = IDLE;
|
||||
shm->scanStop = 0;
|
||||
@ -266,4 +290,10 @@ void sharedMemory_lockLocalLink() { pthread_mutex_lock(&(shm->lockLocalLink)); }
|
||||
void sharedMemory_unlockLocalLink() {
|
||||
pthread_mutex_unlock(&(shm->lockLocalLink));
|
||||
}
|
||||
|
||||
void sharedMemory_lockAcqFlag() { pthread_mutex_lock(&(shm->lockAcqFlag)); }
|
||||
|
||||
void sharedMemory_unlockAcqFlag() {
|
||||
pthread_mutex_unlock(&(shm->lockAcqFlag));
|
||||
}
|
||||
#endif
|
@ -2022,9 +2022,6 @@ void *start_state_machine(void *arg) {
|
||||
}
|
||||
usleep(scanSettleTime_ns / 1000);
|
||||
}
|
||||
#ifdef EIGERD
|
||||
prepareAcquisition();
|
||||
#endif
|
||||
ret = startStateMachine();
|
||||
LOG(logDEBUG2, ("Starting Acquisition ret: %d\n", ret));
|
||||
if (ret == FAIL) {
|
||||
|
Reference in New Issue
Block a user