included exitReceiver, using different threads to listen and write packets in receiver, edited circularfifo to use pointer references, and acquire returns frames caught

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@362 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d
2012-11-30 09:28:52 +00:00
parent d8af12456d
commit 6b935f3bd2
12 changed files with 335 additions and 101 deletions

View File

@@ -10,7 +10,7 @@
* Code & platform dependent issues with it was originally
* published at http://www.kjellkod.cc/threadsafecircularqueue
* 2009-11-02
* @author Kjell Hedström, hedstrom@kjellkod.cc */
* @author Kjell Hedstr<EFBFBD>m, hedstrom@kjellkod.cc */
#ifndef CIRCULARFIFO_H_
#define CIRCULARFIFO_H_
@@ -25,15 +25,15 @@ public:
CircularFifo() : tail(0), head(0){}
virtual ~CircularFifo() {}
bool push(Element& item_);
bool pop(Element& item_);
bool push(Element*& item_);
bool pop(Element*& item_);
bool isEmpty() const;
bool isFull() const;
private:
volatile unsigned int tail; // input index
Element array[Capacity];
Element* array[Capacity];
volatile unsigned int head; // output index
unsigned int increment(unsigned int idx_) const;
@@ -49,7 +49,7 @@ private:
* \param item_ copy by reference the input item
* \return whether operation was successful or not */
template<typename Element, unsigned int Size>
bool CircularFifo<Element, Size>::push(Element& item_)
bool CircularFifo<Element, Size>::push(Element*& item_)
{
int nextTail = increment(tail);
if(nextTail != head)
@@ -70,7 +70,7 @@ bool CircularFifo<Element, Size>::push(Element& item_)
* \param item_ return by reference the wanted item
* \return whether operation was successful or not */
template<typename Element, unsigned int Size>
bool CircularFifo<Element, Size>::pop(Element& item_)
bool CircularFifo<Element, Size>::pop(Element*& item_)
{
if(head == tail)
return false; // empty queue