receiver modified: fifofreed using callback, last fifo freed after all the process, using locks for fifofree, updating currentframenum only in singlephoton if datacompression

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@701 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d
2013-11-29 11:39:22 +00:00
parent 03d0d5e6cd
commit adb500c4a0
5 changed files with 73 additions and 30 deletions

View File

@ -18,6 +18,7 @@
//#include "sls_detector_defs.h"
#include <semaphore.h>
#include <vector>
#include <iostream>
using namespace std;
typedef double double32_t;
@ -45,6 +46,8 @@ public:
bool isEmpty() const;
bool isFull() const;
int getSemValue();
private:
volatile unsigned int tail; // input index
vector <Element*> array;
@ -55,7 +58,13 @@ private:
unsigned int increment(unsigned int idx_) const;
};
template<typename Element>
int CircularFifo<Element>::getSemValue()
{
int value;
sem_getvalue(&free_mutex, &value);
return value;
}
/** Producer only: Adds item to the circular queue.
@ -67,6 +76,7 @@ private:
template<typename Element>
bool CircularFifo<Element>::push(Element*& item_)
{
int nextTail = increment(tail);
if(nextTail != head)
{