DABC (Data Acquisition Backbone Core)  2.9.9
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 
21 {
22  Buffer buf;
23  while (Size()>0) {
24  PopBuffer(buf);
25  buf.Release();
26  }
27 }
28 
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 }
Reference on memory from memory pool.
Definition: Buffer.h:135
bool PopBuffer(Buffer &buf)
Definition: BuffersQueue.h:70
unsigned Size() const
Definition: BuffersQueue.h:79
Lock guard for posix mutex.
Definition: threads.h:127
posix pthread mutex
Definition: threads.h:61
void Release()
Releases reference on the object.
Definition: Reference.cxx:138
bool null() const
Returns true if reference contains nullptr.
Definition: Reference.h:151