fix compile error for i386-optimized refcounting,
[enigma2.git] / lib / base / object.h
index 8ac92b83b0a0ab91e295fe2c7cb07113eb97f41c..1723a885d994c9188815a58d2207590b7af38daf 100644 (file)
@@ -140,7 +140,7 @@ public:
                                if (!ref) \
                                        delete this; \
                        }
-       #elif defined(__i386__)
+       #elif defined(__i386__) || defined(__x86_64__)
                #define DECLARE_REF(x)                  \
                        private: oRefCount ref;         \
                        public: void AddRef();          \
@@ -149,16 +149,16 @@ public:
                        void c::AddRef() \
                        { \
                                __asm__ __volatile__( \
-                               "               incl    %0      \n" \
+                               "               lock ; incl     %0      \n" \
                                : "=m" (ref.count) \
-                               : "m" (ref.count); \
+                               : "m" (ref.count)); \
                        } \
                        void c::Release() \
                        { \
                                __asm__ __volatile__( \
-                               "               decl    %0      \n" \
+                               "               lock ; decl     %0      \n" \
                                : "=m" (ref.count) \
-                               : "m" (ref.count); \
+                               : "m" (ref.count)); \
                                if (!ref) \
                                        delete this; \
                        }