QXRD  0.11.16
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
QcepAllocatorThread Class Reference

#include <qcepallocatorthread.h>

Inheritance diagram for QcepAllocatorThread:
Inheritance graph
[legend]
Collaboration diagram for QcepAllocatorThread:
Collaboration graph
[legend]

Public Member Functions

 QcepAllocatorThread (QcepSettingsSaverPtr saver)
 
 ~QcepAllocatorThread ()
 
void shutdown ()
 
QcepAllocatorPtr allocator () const
 
- Public Member Functions inherited from QcepThread
 QcepThread (QObject *parent=0)
 

Protected Member Functions

void run ()
 

Private Attributes

QcepAllocatorPtr m_Allocator
 
QcepSettingsSaverPtr m_Saver
 

Additional Inherited Members

- Static Public Member Functions inherited from QcepThread
static void msleep (long unsigned int)
 
- Protected Attributes inherited from QcepThread
QMutex m_Mutex
 

Detailed Description

Definition at line 9 of file qcepallocatorthread.h.

Constructor & Destructor Documentation

QcepAllocatorThread::QcepAllocatorThread ( QcepSettingsSaverPtr  saver)

Definition at line 9 of file qcepallocatorthread.cpp.

References DEBUG_CONSTRUCTORS, and qcepDebug().

10  : QcepThread(),
11  m_Allocator(NULL),
12  m_Saver(saver)
13 {
15  printf("QcepAllocatorThread::QcepAllocatorThread(%p)\n", this);
16  }
17 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QcepAllocatorPtr m_Allocator
QcepSettingsSaverPtr m_Saver
QcepThread(QObject *parent=0)
Definition: qcepthread.cpp:3

Here is the call graph for this function:

QcepAllocatorThread::~QcepAllocatorThread ( )

Definition at line 19 of file qcepallocatorthread.cpp.

References DEBUG_CONSTRUCTORS, qcepDebug(), and shutdown().

20 {
21  shutdown();
22 
24  printf("QcepAllocatorThread::~QcepAllocatorThread(%p)\n", this);
25  }
26 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26

Here is the call graph for this function:

Member Function Documentation

QcepAllocatorPtr QcepAllocatorThread::allocator ( ) const

Definition at line 66 of file qcepallocatorthread.cpp.

References m_Allocator, and QcepThread::m_Mutex.

67 {
68 
69  while (isRunning()) {
70  {
71  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
72  if (m_Allocator) return m_Allocator;
73  }
74 
75  QThread::msleep(50);
76  }
77 
78  return QcepAllocatorPtr();
79 }
QcepAllocatorPtr m_Allocator
QMutex m_Mutex
Definition: qcepthread.h:17
QSharedPointer< QcepAllocator > QcepAllocatorPtr
void QcepAllocatorThread::run ( )
protected

Definition at line 28 of file qcepallocatorthread.cpp.

References DEBUG_THREADS, m_Allocator, QcepThread::m_Mutex, m_Saver, and qcepDebug().

29 {
30  if (qcepDebug(DEBUG_THREADS)) {
31  printf("Starting Allocator Thread\n");
32  }
33 
35 
36  int rc = -1;
37 
38  if (p) {
39  m_Mutex.lock();
40 
41  m_Allocator = p;
42 
43  m_Mutex.unlock();
44 
45  rc = exec();
46  }
47 
48  if (qcepDebug(DEBUG_THREADS)) {
49  printf("Allocator Thread Terminated with rc %d\n", rc);
50  }
51 
52  {
53  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
54 
56  }
57 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QcepAllocatorPtr m_Allocator
QcepSettingsSaverPtr m_Saver
QMutex m_Mutex
Definition: qcepthread.h:17
QSharedPointer< QcepAllocator > QcepAllocatorPtr

Here is the call graph for this function:

void QcepAllocatorThread::shutdown ( )

Definition at line 59 of file qcepallocatorthread.cpp.

Referenced by ~QcepAllocatorThread().

60 {
61  exit();
62 
63  wait();
64 }

Here is the caller graph for this function:

Member Data Documentation

QcepAllocatorPtr QcepAllocatorThread::m_Allocator
private

Definition at line 25 of file qcepallocatorthread.h.

Referenced by allocator(), and run().

QcepSettingsSaverPtr QcepAllocatorThread::m_Saver
private

Definition at line 26 of file qcepallocatorthread.h.

Referenced by run().


The documentation for this class was generated from the following files: