Replaced QAtomicInt with mt::atomicInt

This commit is contained in:
Paolo Cignoni 2011-12-14 19:22:17 +00:00
parent 1dc98465ae
commit 9779f0f8c7
4 changed files with 6 additions and 7 deletions

View File

@ -7,6 +7,7 @@
#include <vector> #include <vector>
#include <list> #include <list>
#include <wrap/system/multithreading/mt.h> #include <wrap/system/multithreading/mt.h>
#include <wrap/system/multithreading/atomic_int.h>
#include "provider.h" #include "provider.h"
@ -31,7 +32,7 @@ public:
//if true the cache will exit at the first opportunity //if true the cache will exit at the first opportunity
bool quit; bool quit;
///keeps track of changes (if 1 then something was loaded or dropped ///keeps track of changes (if 1 then something was loaded or dropped
QAtomicInt new_data; mt::atomicInt new_data;
///callback for new_data ///callback for new_data
void (*callback)(void *data); void (*callback)(void *data);
@ -80,7 +81,7 @@ public:
this->heap.clear(); this->heap.clear();
} }
if(!s_curr == 0) { if(!s_curr == 0) {
qDebug() << "Cache size after flush is not ZERO!"; std::cerr << "Cache size after flush is not ZERO!\n";
s_curr = 0; s_curr = 0;
} }
} }

View File

@ -1,7 +1,6 @@
#ifndef GCACHE_CONTROLLER_H #ifndef GCACHE_CONTROLLER_H
#define GCACHE_CONTROLLER_H #define GCACHE_CONTROLLER_H
#include <QDebug>
#include "cache.h" #include "cache.h"
/** Allows to insert tokens, update priorities and generally control the cache. /** Allows to insert tokens, update priorities and generally control the cache.

View File

@ -26,13 +26,12 @@
#define CACHE_DOOR_H #define CACHE_DOOR_H
#include <wrap/system/multithreading/mt.h> #include <wrap/system/multithreading/mt.h>
#include <wrap/system/multithreading/atomic_int.h>
#ifdef QT_CORE_LIB #ifdef QT_CORE_LIB
#include <QWaitCondition> #include <QWaitCondition>
#endif #endif
#include <QAtomicInt>
#define METHOD_2 #define METHOD_2
#ifdef METHOD_1 #ifdef METHOD_1

View File

@ -1,7 +1,7 @@
#ifndef GCACHE_TOKEN_H #ifndef GCACHE_TOKEN_H
#define GCACHE_TOKEN_H #define GCACHE_TOKEN_H
#include <QAtomicInt> #include <wrap/system/multithreading/atomic_int.h>
/* QAtomic int count keep trak of token status: /* QAtomic int count keep trak of token status:
>0: locked (possibly multiple times) >0: locked (possibly multiple times)
@ -34,7 +34,7 @@ class Token {
///swap space used in updatePriorities [do not use, should be private] ///swap space used in updatePriorities [do not use, should be private]
Priority tmp_priority; Priority tmp_priority;
///reference count of locked items [do not use, should be private] ///reference count of locked items [do not use, should be private]
QAtomicInt count; mt::atomicInt count;
public: public:
Token(): count(OUTSIDE) {} Token(): count(OUTSIDE) {}