1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-10-06 22:32:48 +00:00

Update ttvfs to new version

This commit is contained in:
fgenesis 2014-04-06 19:19:33 +02:00
commit 8026cdd905
43 changed files with 2124 additions and 2427 deletions

View file

@ -2,7 +2,6 @@
#define SELFREFCOUNTER_H
#include "VFSDefines.h"
#include "VFSAtomic.h"
VFS_NAMESPACE_START
@ -11,11 +10,11 @@ template <class T, bool DELSELF = true> class SelfRefCounter
{
private:
T *self;
volatile int c;
int c;
SelfRefCounter(SelfRefCounter& r); // forbid copy constructor
inline unsigned int _deref(void)
{
volatile unsigned int cc = (unsigned int)Atomic_Decr(c); // copy c, in case we get deleted
unsigned int cc = (unsigned int)(c - 1); // copy c, in case we get deleted
if(DELSELF && !cc)
{
delete self;
@ -30,11 +29,11 @@ public:
inline unsigned int count(void) { return c; }
// post-increment (dummy int)
inline unsigned int operator++(int) { unsigned int cc = c; Atomic_Incr(c); return cc; }
inline unsigned int operator++(int) { unsigned int cc = c; ++c; return cc; }
inline unsigned int operator--(int) { unsigned int cc = c; _deref(); return cc; }
// pre-increment
inline unsigned int operator++(void) { return (unsigned int)Atomic_Incr(c); }
inline unsigned int operator++(void) { return (unsigned int)++c; }
inline unsigned int operator--(void) { return _deref(); }
};