DABC (Data Acquisition Backbone Core)
2.9.9
base
src
BuffersQueue.cxx
Go to the documentation of this file.
1
// $Id: BuffersQueue.cxx 1549 2013-04-11 14:25:03Z linev $
2
3
/************************************************************
4
* The Data Acquisition Backbone Core (DABC) *
5
************************************************************
6
* Copyright (C) 2009 - *
7
* GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
8
* Planckstr. 1, 64291 Darmstadt, Germany *
9
* Contact: http://dabc.gsi.de *
10
************************************************************
11
* This software can be used under the GPL license *
12
* agreements as stated in LICENSE.txt file *
13
* which is part of the distribution. *
14
************************************************************/
15
16
#include "
dabc/BuffersQueue.h
"
17
18
#include "
dabc/threads.h
"
19
20
void
dabc::BuffersQueue::Cleanup
()
21
{
22
Buffer
buf;
23
while
(
Size
()>0) {
24
PopBuffer
(buf);
25
buf.
Release
();
26
}
27
}
28
29
void
dabc::BuffersQueue::Cleanup
(
Mutex
* m)
30
{
31
Buffer
buf;
32
33
do
{
34
buf.
Release
();
35
36
dabc::LockGuard
lock(m);
37
38
if
(Size()>0) PopBuffer(buf);
39
40
}
while
(!buf.
null
());
41
}
BuffersQueue.h
dabc::Buffer
Reference on memory from memory pool.
Definition:
Buffer.h:135
dabc::BuffersQueue::Cleanup
void Cleanup()
Definition:
BuffersQueue.cxx:20
dabc::BuffersQueue::PopBuffer
bool PopBuffer(Buffer &buf)
Definition:
BuffersQueue.h:70
dabc::BuffersQueue::Size
unsigned Size() const
Definition:
BuffersQueue.h:79
dabc::LockGuard
Lock guard for posix mutex.
Definition:
threads.h:127
dabc::Mutex
posix pthread mutex
Definition:
threads.h:61
dabc::Reference::Release
void Release()
Releases reference on the object.
Definition:
Reference.cxx:138
dabc::Reference::null
bool null() const
Returns true if reference contains nullptr.
Definition:
Reference.h:151
threads.h
Generated by
1.9.1