void PlaceHolder::setReal(Object::const_ptr r) { if (Object::const_ptr old = real()) old->unref(); d()->real = r->d(); if (r) r->ref(); }
bool Object::Data::addAttachment(const std::string &key, Object::const_ptr obj) { boost::interprocess::scoped_lock<boost::interprocess::interprocess_recursive_mutex> lock(attachment_mutex); const Key skey(key.c_str(), Shm::the().allocator()); AttachmentMap::iterator it = attachments->find(skey); if (it != attachments->end()) { return false; } obj->ref(); attachments->insert(AttachmentMapValueType(skey, obj->d())); return true; }
bool Object::Data::addAttachment(const std::string &key, Object::const_ptr obj) { attachment_mutex_lock_type lock(attachment_mutex); const Key skey(key.c_str(), Shm::the().allocator()); AttachmentMap::const_iterator it = attachments.find(skey); if (it != attachments.end()) { return false; } obj->ref(); attachments.insert(AttachmentMapValueType(skey, obj->d())); return true; }