mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
replaced usleep which waits for queue to have data, with semaphores
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@732 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -35,7 +35,9 @@ postProcessing::postProcessing(): expTime(NULL), ang(NULL), val(NULL), err(NULL)
|
||||
pCallbackArg = 0;
|
||||
//cout << "done "<< endl;
|
||||
rawDataReady = 0;
|
||||
pRawDataArg = 0;
|
||||
pRawDataArg = 0;
|
||||
|
||||
sem_init(&queue_mutex,0,0);
|
||||
|
||||
#ifdef VERBOSE
|
||||
registerDataCallback(&defaultDataReadyFunc, NULL);
|
||||
@ -581,6 +583,7 @@ int* postProcessing::popDataQueue() {
|
||||
cout << "Pop data queue lock" << endl;
|
||||
#endif
|
||||
|
||||
sem_wait(&queue_mutex);
|
||||
pthread_mutex_lock(&mp);
|
||||
if( !dataQueue.empty() ) {
|
||||
retval=dataQueue.front();
|
||||
@ -609,6 +612,7 @@ void postProcessing::resetDataQueue() {
|
||||
int *retval=NULL;
|
||||
pthread_mutex_lock(&mp);
|
||||
while( !dataQueue.empty() ) {
|
||||
sem_wait(&queue_mutex);
|
||||
retval=dataQueue.front();
|
||||
dataQueue.pop();
|
||||
delete [] retval;
|
||||
|
Reference in New Issue
Block a user