mirror of
https://github.com/ceph/ceph
synced 2025-02-21 01:47:25 +00:00
common: add RefCountedObj.cc with intrusive_ptr hooks
Signed-off-by: Samuel Just <sam.just@inktank.com>
This commit is contained in:
parent
c4981b8128
commit
d12911252b
@ -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 \
|
||||
|
23
src/common/RefCountedObj.cc
Normal file
23
src/common/RefCountedObj.cc
Normal file
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user