Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 6 Jul 2017 08:27:27 +0000 (10:27 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 6 Jul 2017 08:27:27 +0000 (10:27 +0200)
ChangeLog
include/simgrid/s4u/Comm.hpp
src/s4u/s4u_comm.cpp

index 34788ca..9f70fdb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,8 @@
 SimGrid (3.17) UNRELEASED (release target: September 22 2017)
 
  S4U
-  - start and forget about isend comms with detach()
+  - Comm.detach(): start and forget about asynchronous emission
+  - this_actor::send(mailbox) is now mailbox->put()
 
 SimGrid (3.16) Released June 22. 2017.
 
index 16682aa..a2c71d0 100644 (file)
@@ -112,6 +112,9 @@ public:
   bool test();
   void cancel();
 
+  /** Retrieve the mailbox on which this comm acts */
+  MailboxPtr mailbox();
+
 private:
   double rate_        = -1;
   void* dstBuff_      = nullptr;
index 070f7d1..95a5a87 100644 (file)
@@ -83,7 +83,10 @@ void Comm::start() {
   state_ = started;
 }
 void Comm::wait() {
-  xbt_assert(state_ == started || state_ == inited);
+  xbt_assert(state_ == started || state_ == inited || state_ == finished);
+
+  if (state_ == finished)
+    return;
 
   if (state_ == started)
     simcall_comm_wait(pimpl_, -1/*timeout*/);
@@ -103,7 +106,10 @@ void Comm::wait() {
 }
 
 void Comm::wait(double timeout) {
-  xbt_assert(state_ == started || state_ == inited);
+  xbt_assert(state_ == started || state_ == inited || state_ == finished);
+
+  if (state_ == finished)
+    return;
 
   if (state_ == started) {
     simcall_comm_wait(pimpl_, timeout);
@@ -140,7 +146,8 @@ void Comm::cancel()
   commPimpl->cancel();
 }
 
-bool Comm::test() {
+bool Comm::test()
+{
   xbt_assert(state_ == inited || state_ == started || state_ == finished);
 
   if (state_ == finished) {
@@ -158,6 +165,11 @@ bool Comm::test() {
   return false;
 }
 
+MailboxPtr Comm::mailbox()
+{
+  return mailbox_;
+}
+
 void intrusive_ptr_release(simgrid::s4u::Comm* c)
 {
   if (c->refcount_.fetch_sub(1, std::memory_order_release) == 1) {