aboutsummaryrefslogtreecommitdiff
path: root/lib/base/object.h
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-07-23 18:05:19 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-07-23 18:05:19 +0000
commit7463ffd4aba6da4f0cbb995ce7743293798b07b8 (patch)
tree1eeb34a5b123dc389eb2714b42ed6b07574eead6 /lib/base/object.h
parent831b789edd2c650158e91c9e08db55ebee1a1b3c (diff)
downloadenigma2-7463ffd4aba6da4f0cbb995ce7743293798b07b8.tar.gz
enigma2-7463ffd4aba6da4f0cbb995ce7743293798b07b8.zip
no class needed here
Diffstat (limited to 'lib/base/object.h')
-rw-r--r--lib/base/object.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/lib/base/object.h b/lib/base/object.h
index 987511be..adb5d67c 100644
--- a/lib/base/object.h
+++ b/lib/base/object.h
@@ -25,15 +25,14 @@ public:
virtual void Release()=0;
};
-class oRefCount
+struct oRefCount
{
- volatile int ref;
-public:
- oRefCount(): ref(0) { }
- operator volatile int&() { return ref; }
+ volatile int count;
+ oRefCount(): count(0) { }
+ operator volatile int&() { return count; }
~oRefCount() {
#ifdef OBJECT_DEBUG
- if (ref) eDebug("OBJECT_DEBUG FATAL: %p has %d references!", this, ref); else eDebug("OBJECT_DEBUG refcount ok! (%p)", this);
+ if (count) eDebug("OBJECT_DEBUG FATAL: %p has %d references!", this, ref); else eDebug("OBJECT_DEBUG refcount ok! (%p)", this);
#endif
}
};
@@ -57,8 +56,8 @@ public:
" sc %0, %1 # try to store, checking for atomicity \n" \
" .set mips0 \n" \
" beqz %0, 1b # if not atomic (0), try again \n" \
- : "=&r" (temp), "=m" ((int)ref) \
- : "m" ((int)ref) \
+ : "=&r" (temp), "=m" (ref.count) \
+ : "m" (ref.count) \
: ); \
} \
void c::Release() \
@@ -73,8 +72,8 @@ public:
" sc %0, %1 \n" \
" .set mips0 \n" \
" beqz %0, 1b \n" \
- : "=&r" (temp), "=m" ((int)ref) \
- : "m" ((int)ref) \
+ : "=&r" (temp), "=m" (ref.count) \
+ : "m" (ref.count) \
: ); \
if (!ref) \
delete this; \
@@ -94,8 +93,8 @@ public:
" dcbt 0, %3 # workaround for PPC405CR Errata\n" \
" stwcx. %0, 0, %3 \n" \
" bne- 1b \n" \
- : "=&r" (temp), "=m" ((int)ref) \
- : "r" (1), "r" (&((int)ref)), "m" ((int)ref) \
+ : "=&r" (temp), "=m" (ref.count) \
+ : "r" (1), "r" (&ref.count), "m" (ref.count) \
: "cc"); \
} \
void c::Release() \
@@ -107,8 +106,8 @@ public:
" dcbt 0, %3 # workaround for PPC405CR Errata\n" \
" stwcx. %0, 0, %3 \n" \
" bne- 1b \n" \
- : "=&r" (temp), "=m" ((int)ref) \
- : "r" (1), "r" (&((int)ref)), "m" ((int)ref) \
+ : "=&r" (temp), "=m" (ref.count) \
+ : "r" (1), "r" (&ref.count), "m" (ref.count) \
: "cc"); \
if (!ref) \
delete this; \
@@ -127,7 +126,7 @@ public:
eSingleLocker l(ref_lock); \
++object_total_remaining; \
++ref; \
- eDebug("OBJECT_DEBUG " #c "+%p now %d", this, (int)ref); \
+ eDebug("OBJECT_DEBUG " #c "+%p now %d", this, ref.count); \
} \
void c::Release() \
{ \