aboutsummaryrefslogtreecommitdiff
path: root/odb/shared-ptr/base.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-08-18 17:49:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-08-18 17:49:47 +0200
commitd8b70727fdda5c1de19736724809e76e060b417e (patch)
tree502acf3022b310816c0d4a83dba2b63291f5e6a9 /odb/shared-ptr/base.ixx
parent189d4fbad840ab397cfb62e24b05912b68716518 (diff)
Add callback support for zero counter event in shared_base
Diffstat (limited to 'odb/shared-ptr/base.ixx')
-rw-r--r--odb/shared-ptr/base.ixx9
1 files changed, 6 insertions, 3 deletions
diff --git a/odb/shared-ptr/base.ixx b/odb/shared-ptr/base.ixx
index ee27fbe..61270a3 100644
--- a/odb/shared-ptr/base.ixx
+++ b/odb/shared-ptr/base.ixx
@@ -25,13 +25,13 @@ namespace odb
inline shared_base::
shared_base ()
- : counter_ (1)
+ : counter_ (1), callback_ (0)
{
}
inline shared_base::
shared_base (const shared_base&)
- : counter_ (1)
+ : counter_ (1), callback_ (0)
{
}
@@ -50,7 +50,10 @@ namespace odb
inline bool shared_base::
_dec_ref ()
{
- return --counter_ == 0;
+ if (callback_ == 0)
+ return --counter_ == 0;
+ else
+ return _dec_ref_callback ();
}
inline std::size_t shared_base::