aboutsummaryrefslogtreecommitdiff
path: root/odb/shared-ptr/base.cxx
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.cxx
parent189d4fbad840ab397cfb62e24b05912b68716518 (diff)
Add callback support for zero counter event in shared_base
Diffstat (limited to 'odb/shared-ptr/base.cxx')
-rw-r--r--odb/shared-ptr/base.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/odb/shared-ptr/base.cxx b/odb/shared-ptr/base.cxx
index 56fc32c..197d20b 100644
--- a/odb/shared-ptr/base.cxx
+++ b/odb/shared-ptr/base.cxx
@@ -21,6 +21,20 @@ namespace odb
{
return "object is not shared";
}
+
+ bool shared_base::
+ _dec_ref_callback ()
+ {
+ bool r (--counter_ == 0);
+
+ if (r)
+ {
+ callback_->zero_counter (callback_->arg);
+ r = (counter_ == 0);
+ }
+
+ return r;
+ }
}
//