From: Gabriel Corona Date: Wed, 20 Jul 2016 14:39:20 +0000 (+0200) Subject: Merge remote-tracking branch 'adfaure/master' X-Git-Tag: v3_14~737^2~6 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/cf75523de37862d1f4eddaa1cbdd276f20755fea?hp=0c987e308f4523b066cbba60894c665f088cad6b Merge remote-tracking branch 'adfaure/master' --- diff --git a/include/simgrid/s4u/comm.hpp b/include/simgrid/s4u/comm.hpp index 47c7332c91..2929750de8 100644 --- a/include/simgrid/s4u/comm.hpp +++ b/include/simgrid/s4u/comm.hpp @@ -56,6 +56,8 @@ public: /** Retrieve the size of the received data */ size_t getDstDataSize(); + bool test(); + private: double rate_ = -1; diff --git a/src/s4u/s4u_comm.cpp b/src/s4u/s4u_comm.cpp index 591040574a..401a6c2b80 100644 --- a/src/s4u/s4u_comm.cpp +++ b/src/s4u/s4u_comm.cpp @@ -146,5 +146,22 @@ s4u::Comm &Comm::recv_async(Mailbox &dest, void **data) { return res; } +bool Comm::test() { + xbt_assert(state_ == inited || state_ == started || state_ == finished); + + if (state_ == finished) + xbt_die("Don't call test on a finished comm."); + + if (state_ == inited) { + this->start(); + } + + if(simcall_comm_test(pimpl_)){ + state_ = finished; + return true; + } + return false; +} + } }