two acquires at the same tiem should not be possile. using shared memory to set flag, made all connect use the standard connectControl etc

This commit is contained in:
Dhanya Maliakal
2015-11-20 16:28:48 +01:00
parent a1bd54b16b
commit c097dfc8b3
18 changed files with 474 additions and 205 deletions

View File

@ -41,7 +41,18 @@ slsDetectorUtils::slsDetectorUtils() {
void slsDetectorUtils::acquire(int delflag){
int slsDetectorUtils::acquire(int delflag){
//ensure acquire isnt started multiple times by same client
pthread_mutex_lock(&mp);
if(getAcquiringFlag() == false)
setAcquiringFlag(true);
else{
std::cout << "Error: Acquire has already been started." << std::endl;
return FAIL;
}
pthread_mutex_unlock(&mp);
bool receiver = (setReceiverOnline()==ONLINE_FLAG);
if(!receiver){
@ -526,6 +537,10 @@ void slsDetectorUtils::acquire(int delflag){
#ifdef VERBOSE
cout << "acquisition finished callback done " << endl;
#endif
setAcquiringFlag(false);
return OK;
}