mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
update
This commit is contained in:
@ -78,7 +78,11 @@ int CircularFifo<Element>::getSemValue()
|
||||
template<typename Element>
|
||||
bool CircularFifo<Element>::push(Element*& item_)
|
||||
{
|
||||
int nextTail = increment(tail);
|
||||
|
||||
//cout<<"*head:"<<head<<endl;
|
||||
//cout<<"*tail before"<<tail<<endl;
|
||||
unsigned int nextTail = increment(tail);
|
||||
//cout<<"*next tail"<<nextTail<<endl;
|
||||
if(nextTail != head)
|
||||
{
|
||||
array[tail] = item_;
|
||||
@ -99,12 +103,15 @@ bool CircularFifo<Element>::push(Element*& item_)
|
||||
template<typename Element>
|
||||
bool CircularFifo<Element>::pop(Element*& item_)
|
||||
{
|
||||
// if(head == tail)
|
||||
// return false; // empty queue
|
||||
//cout<<"-tail:"<<tail<<endl;
|
||||
//cout<<"-head before:"<<head<<endl;
|
||||
//if(head == tail)
|
||||
// return false; // empty queue
|
||||
sem_wait(&free_mutex);
|
||||
|
||||
item_ = array[head];
|
||||
head = increment(head);
|
||||
//cout<<"-head after:"<<head<<endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user