![]() ![]() |
![]() |
File: [Pegasus] / pegasus / src / Pegasus / Common / Attic / Atomic_Generic.h
(download)
Revision: 1.1.2.1, Wed Sep 28 01:07:29 2005 UTC (18 years, 9 months ago) by mike Branch: PEGASUS_2_5_0_PerformanceDev-branch CVS Tags: PEGASUS_2_5_0_PerformanceDev-string-end, PEGASUS_2_5_0_PerformanceDev-r2, PEGASUS_2_5_0_PerformanceDev-r1, PEGASUS_2_5_0_PerformanceDev-lit-end, PEGASUS_2_5_0_PerformanceDev-buffer-end Changes since 1.1: +45 -0 lines BUG#: 4200 TITLE: Performance Optimizations DESCRIPTION: Rewrite and adaptation of string class. |
#ifndef _Pegasus_Common_Atomic_Generic_h #define _Pegasus_Common_Atomic_Generic_h #include <Pegasus/Common/Config.h> #include <Pegasus/Common/IPC.h> PEGASUS_NAMESPACE_BEGIN struct Atomic { union { Uint64 alignment; char _rep[sizeof(AtomicInt)]; }; }; inline void Atomic_create(Atomic* v, int x) { new(&v->_rep) AtomicInt(x); } inline void Atomic_destroy(Atomic* v) { ((AtomicInt*)&v->_rep)->~AtomicInt(); } inline int Atomic_get(const Atomic* v) { return ((AtomicInt*)&v->_rep)->value(); } inline void Atomic_inc(Atomic *v) { ((AtomicInt*)&v->_rep)->operator++(); } inline int Atomic_dec_and_test(Atomic *v) { return ((AtomicInt*)&v->_rep)->DecAndTestIfZero(); } PEGASUS_NAMESPACE_END #endif /* _Pegasus_Common_Atomic_Generic_h */
No CVS admin address has been configured |
Powered by ViewCVS 0.9.2 |