mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-17 18:23:41 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user