+void Comm::cancel()
+{
+ simgrid::kernel::activity::CommImplPtr commPimpl =
+ boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(pimpl_);
+ commPimpl->cancel();
+}
+
+bool Comm::test() {
+ xbt_assert(state_ == inited || state_ == started || state_ == finished);
+
+ if (state_ == finished) {
+ return true;
+ }
+
+ if (state_ == inited) {
+ this->start();
+ }
+
+ if(simcall_comm_test(pimpl_)){
+ state_ = finished;
+ return true;
+ }
+ return false;
+}
+
+void intrusive_ptr_release(simgrid::s4u::Comm* c)
+{
+ if (c->refcount_.fetch_sub(1, std::memory_order_release) == 1) {
+ std::atomic_thread_fence(std::memory_order_acquire);
+ delete c;
+ }
+}
+void intrusive_ptr_add_ref(simgrid::s4u::Comm* c)
+{
+ c->refcount_.fetch_add(1, std::memory_order_relaxed);