]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: add RefCountedObj.cc with intrusive_ptr hooks
authorSamuel Just <sam.just@inktank.com>
Tue, 2 Oct 2012 20:33:11 +0000 (13:33 -0700)
committerSamuel Just <sam.just@inktank.com>
Tue, 13 Nov 2012 18:45:00 +0000 (10:45 -0800)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/Makefile.am
src/common/RefCountedObj.cc [new file with mode: 0644]
src/common/RefCountedObj.h
src/msg/Message.cc
src/msg/Message.h

index fef3dea6496e47d99f87859aeb19fbb71ef7ff86..4e9e10a781681de839ea19beeb06eb0b97bedeef 100644 (file)
@@ -1211,6 +1211,7 @@ libcommon_files = \
        msg/Accepter.cc \
        msg/DispatchQueue.cc \
        msg/Message.cc \
+       common/RefCountedObj.cc \
        msg/Messenger.cc \
        msg/Pipe.cc \
        msg/SimpleMessenger.cc \
diff --git a/src/common/RefCountedObj.cc b/src/common/RefCountedObj.cc
new file mode 100644 (file)
index 0000000..236a2b1
--- /dev/null
@@ -0,0 +1,23 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software 
+ * Foundation.  See file COPYING.
+ * 
+ */
+
+#include "common/RefCountedObj.h"
+
+void intrusive_ptr_add_ref(RefCountedObject *p) {
+  p->get();
+}
+void intrusive_ptr_release(RefCountedObject *p) {
+  p->put();
+}
+
index 0af419425374a82f3229ea60f96c4071294372e1..4bbbc8dfa61d211ea807fee4c56b7ddf0d8012cb 100644 (file)
@@ -15,6 +15,8 @@
 #ifndef CEPH_REFCOUNTEDOBJ_H
 #define CEPH_REFCOUNTEDOBJ_H
  
+#include "common/Mutex.h"
+#include "common/Cond.h"
 #include "include/atomic.h"
 
 
@@ -116,5 +118,7 @@ struct RefCountedWaitObject {
   }
 };
 
+void intrusive_ptr_add_ref(RefCountedObject *p);
+void intrusive_ptr_release(RefCountedObject *p);
 
 #endif
index ce1f060c09364d4b0a7a7e7435896caafa5a50cc..8d4a2f7e4d607a1106b51debcb00a5f63849197f 100644 (file)
@@ -152,16 +152,6 @@ using namespace std;
 
 #define dout_subsys ceph_subsys_ms
 
-void intrusive_ptr_add_ref(Message *p)
-{
-  p->get();
-}
-
-void intrusive_ptr_release(Message *p)
-{
-  p->put();
-}
-
 void Message::encode(uint64_t features, bool datacrc)
 {
   // encode and copy out of *m
index 11c2cacf73c0b2c231c9d2ee4347c46353b7382b..b6a113f771fb8edad60ac3850ee0dacdf82fe2ac 100644 (file)
@@ -480,8 +480,4 @@ inline ostream& operator<<(ostream& out, Message& m) {
 extern void encode_message(Message *m, uint64_t features, bufferlist& bl);
 extern Message *decode_message(CephContext *cct, bufferlist::iterator& bl);
 
-void intrusive_ptr_add_ref(Message *p);
-void intrusive_ptr_release(Message *p);
-
-
 #endif