version 1.18, 2005/11/07 23:18:15
|
version 1.19, 2005/11/20 06:35:26
|
|
|
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/Linkage.h> | #include <Pegasus/Common/Linkage.h> |
#include <Pegasus/Common/IPC.h> | #include <Pegasus/Common/IPC.h> |
#include <assert.h> |
#include <Pegasus/Common/PegasusAssert.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
friend void Dec(Sharable* sharable); | friend void Dec(Sharable* sharable); |
| |
private: | private: |
Sharable(const Sharable &s) : _ref(1) {assert(0);} |
Sharable(const Sharable &s) : _ref(1) {PEGASUS_DEBUG_ASSERT(0);} |
// we should never copy a counter, so we make this private - dte | // we should never copy a counter, so we make this private - dte |
AtomicInt _ref; | AtomicInt _ref; |
}; | }; |
|
|
{ | { |
if (x) | if (x) |
{ | { |
#ifdef PEGASUS_DEBUG |
|
// A sharable object should never be incremented from zero. | // A sharable object should never be incremented from zero. |
// If so, there is a double delete being cause by impropoer use | // If so, there is a double delete being cause by impropoer use |
// of sharable assignment or copy constructors somewhere | // of sharable assignment or copy constructors somewhere |
// << Wed Nov 6 12:46:52 2002 mdd >> | // << Wed Nov 6 12:46:52 2002 mdd >> |
assert(((Sharable*)x)->_ref.get()); |
PEGASUS_DEBUG_ASSERT(((Sharable*)x)->_ref.get()); |
#endif |
|
x->_ref++; | x->_ref++; |
} | } |
} | } |