Commit dcc96bfc authored by Jakob Otto's avatar Jakob Otto

Remove intrusive_ptr functions

parent 77279674
......@@ -92,50 +92,6 @@ private:
}
};
/// @relates actor_storage
template <class T>
bool intrusive_ptr_upgrade_weak(actor_storage<T>* x) {
auto count = x->ctrl.strong_refs.load();
while (count != 0) {
if (x->ctrl.strong_refs.compare_exchange_weak(count, count + 1,
std::memory_order_relaxed))
return true;
}
return false;
}
/// @relates actor_storage
template <class T>
void intrusive_ptr_add_weak_ref(actor_storage<T>* x) {
x->ctrl.weak_refs.fetch_add(1, std::memory_order_relaxed);
}
/// @relates actor_storage
template <class T>
void intrusive_ptr_release_weak(actor_storage<T>* x) {
// destroy object if last weak pointer expires
if (x->ctrl.weak_refs == 1
|| x->ctrl.weak_refs.fetch_sub(1, std::memory_order_acq_rel) == 1)
delete x;
}
/// @relates actor_storage
template <class T>
void intrusive_ptr_add_ref(actor_storage<T>* x) {
x->ctrl.strong_refs.fetch_add(1, std::memory_order_relaxed);
}
/// @relates actor_storage
template <class T>
void intrusive_ptr_release(actor_storage<T>* x) {
// release implicit weak pointer if the last strong ref expires
// and destroy the data block
if (x->ctrl.strong_refs.fetch_sub(1, std::memory_order_acq_rel) == 1) {
x->destroy_data();
intrusive_ptr_release_weak(x);
}
}
} // namespace caf
#ifdef CAF_GCC
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment