Skip to content

Instantly share code, notes, and snippets.

@simonwelsh
Last active August 29, 2015 13:59
Show Gist options
  • Save simonwelsh/10441064 to your computer and use it in GitHub Desktop.
Save simonwelsh/10441064 to your computer and use it in GitHub Desktop.
class MemcachedData {
public:
class Impl {
public:
Impl() :
compression(true),
serializer(q_Memcached$$SERIALIZER_PHP),
rescode(q_Memcached$$RES_SUCCESS) {
memcached_create(&memcached);
};
~Impl() {
memcached_free(&memcached);
}
memcached_st memcached;
bool compression;
int serializer;
int rescode;
};
MemcachedData() {}
~MemcachedData() {}
typedef std::shared_ptr<Impl> ImplPtr;
ImplPtr m_impl;
}
#define FETCH_MEMCACHED_DATA(dest, src) \
assert(!src.isNull()); \
auto dest = Native::data<MemcachedData>(src.get()); \
assert(dest);
void HHVM_METHOD(Memcached, __construct,
const Variant& persistent_id /*= null*/) {
FETCH_MEMCACHED_DATA(data, this_);
if (persistent_id.isNull()) {
data->m_impl.reset(new MemcachedData::Impl);
}
}
# 0 HPHP::bt_handler(int) at crash-reporter.cpp:0
# 1 killpg at /lib/x86_64-linux-gnu/libc.so.6:0
# 2 std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() at ./hphp/hhvm/hhvm:0
# 3 HPHP::c_Memcached_ni___construct(HPHP::Object const&, HPHP::Variant const&) at ./hphp/hhvm/hhvm:0
# 4 HPHP::Native::callFunc(HPHP::Func const*, HPHP::TypedValue*, HPHP::TypedValue*, int, HPHP::TypedValue&) at ./hphp/hhvm/hhvm:0
# 5 HPHP::Native::methodWrapper(HPHP::ActRec*) at ./hphp/hhvm/hhvm:0
# 6 void HPHP::ExecutionContext::dispatchImpl<0>(int) at ./hphp/hhvm/hhvm:0
# 7 HPHP::ExecutionContext::enterVM(HPHP::ActRec*, unsigned char const*, HPHP::ObjectData*) at ./hphp/hhvm/hhvm:0
# 8 HPHP::ExecutionContext::invokeFunc(HPHP::TypedValue*, HPHP::Func const*, HPHP::Variant const&, HPHP::ObjectData*, HPHP::Class*, HPHP::VarEnv*, HPHP::StringData*, HPHP::ExecutionContext::InvokeFlags) at ./hphp/hhvm/hhvm:0
# 9 HPHP::ExecutionContext::invokeUnit(HPHP::TypedValue*, HPHP::Unit*) at ./hphp/hhvm/hhvm:0
# 10 HPHP::invoke_file(HPHP::String const&, bool, char const*) at ./hphp/hhvm/hhvm:0
# 11 HPHP::include_impl_invoke(HPHP::String const&, bool, char const*) at ./hphp/hhvm/hhvm:0
# 12 HPHP::hphp_invoke(HPHP::ExecutionContext*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, HPHP::Array const&, HPHP::VRefParamValue const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool, bool, bool) at ./hphp/hhvm/hhvm:0
# 13 HPHP::hphp_invoke_simple(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) at ./hphp/hhvm/hhvm:0
# 14 HPHP::execute_program_impl(int, char**) at program-functions.cpp:0
# 15 HPHP::execute_program(int, char**) at ./hphp/hhvm/hhvm:0
# 16 main at ./hphp/hhvm/hhvm:0
# 17 __libc_start_main at /home/aurel32/eglibc/eglibc-2.17/csu/libc-start.c:310
# 18 _start at ./hphp/hhvm/hhvm:0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment