mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 15:50:03 +02:00
improved locking a bit
This commit is contained in:
parent
121e9faf56
commit
44a69e2aee
@ -171,7 +171,9 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
|
|
||||||
//resets frames caught in receiver
|
//resets frames caught in receiver
|
||||||
if(receiver){
|
if(receiver){
|
||||||
|
pthread_mutex_lock(&mg);
|
||||||
resetFramesCaught();
|
resetFramesCaught();
|
||||||
|
pthread_mutex_unlock(&mg);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int im=0;im<nm;im++) {
|
for(int im=0;im<nm;im++) {
|
||||||
@ -340,9 +342,9 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
|
|
||||||
|
|
||||||
//offline
|
//offline
|
||||||
|
pthread_mutex_lock(&mg);
|
||||||
if(setReceiverOnline()==OFFLINE_FLAG){
|
if(setReceiverOnline()==OFFLINE_FLAG){
|
||||||
// wait until data processing thread has finished the data
|
// wait until data processing thread has finished the data
|
||||||
pthread_mutex_lock(&mg);
|
|
||||||
acquiringDone = 1;
|
acquiringDone = 1;
|
||||||
pthread_mutex_unlock(&mg);
|
pthread_mutex_unlock(&mg);
|
||||||
if (*threadedProcessing) {
|
if (*threadedProcessing) {
|
||||||
@ -372,7 +374,6 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
|
|
||||||
//online
|
//online
|
||||||
else{
|
else{
|
||||||
pthread_mutex_lock(&mg);
|
|
||||||
acquiringDone = 1;
|
acquiringDone = 1;
|
||||||
pthread_mutex_unlock(&mg);
|
pthread_mutex_unlock(&mg);
|
||||||
|
|
||||||
|
@ -512,12 +512,10 @@ void* postProcessing::processData(int delflag) {
|
|||||||
usleep(20000); //20ms need this else connecting error to receiver (too fast)
|
usleep(20000); //20ms need this else connecting error to receiver (too fast)
|
||||||
|
|
||||||
//get progress
|
//get progress
|
||||||
if(setReceiverOnline() == ONLINE_FLAG){
|
|
||||||
pthread_mutex_lock(&mg);
|
pthread_mutex_lock(&mg);
|
||||||
|
if(setReceiverOnline() == ONLINE_FLAG)
|
||||||
caught = getFramesCaughtByReceiver();
|
caught = getFramesCaughtByReceiver();
|
||||||
pthread_mutex_unlock(&mg);
|
pthread_mutex_unlock(&mg);
|
||||||
}
|
|
||||||
|
|
||||||
//updating progress
|
//updating progress
|
||||||
if(caught!= -1){
|
if(caught!= -1){
|
||||||
setCurrentProgress(caught);
|
setCurrentProgress(caught);
|
||||||
@ -609,13 +607,12 @@ void* postProcessing::processData(int delflag) {
|
|||||||
}
|
}
|
||||||
//gui
|
//gui
|
||||||
else{
|
else{
|
||||||
|
pthread_mutex_lock(&mg);
|
||||||
if(setReceiverOnline()==ONLINE_FLAG){
|
if(setReceiverOnline()==ONLINE_FLAG){
|
||||||
//get data
|
//get data
|
||||||
strcpy(currentfName,"");
|
strcpy(currentfName,"");
|
||||||
pthread_mutex_lock(&mg);
|
|
||||||
//int* receiverData = new int [getTotalNumberOfChannels()];
|
//int* receiverData = new int [getTotalNumberOfChannels()];
|
||||||
int* receiverData = readFrameFromReceiver(currentfName,currentAcquisitionIndex,currentFrameIndex,currentSubFrameIndex);
|
int* receiverData = readFrameFromReceiver(currentfName,currentAcquisitionIndex,currentFrameIndex,currentSubFrameIndex);
|
||||||
pthread_mutex_unlock(&mg);
|
|
||||||
|
|
||||||
//if detector returned null
|
//if detector returned null
|
||||||
if(setReceiverOnline()==OFFLINE_FLAG)
|
if(setReceiverOnline()==OFFLINE_FLAG)
|
||||||
@ -659,6 +656,7 @@ void* postProcessing::processData(int delflag) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pthread_mutex_unlock(&mg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user