Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
change the prototype of s4u::Comm::wait_any to mimick the C code
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 5 Jul 2017 23:18:41 +0000 (01:18 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 5 Jul 2017 23:18:45 +0000 (01:18 +0200)
commit08447964cfc19a4b579429ef71c0fccebd60199f
tree3c4af39dc497473d9b7d49cd138c89f7706592fe
parent380344ba7ad3d0ed0f7fb8f86990e83b97f39831
change the prototype of s4u::Comm::wait_any to mimick the C code

Returning an iterator was not working as we returned every elements in
the input collection, without any sorting (fix #170).

Returning a collection or an iterator is difficult, as is. We would
have to build the collection in the backstage, iterating over the
provided comms to see which ones are done.

Plus, the user would probably want to then find these comms in the
provided vector to remove them from there.

In the end, that would be a lot of useless and potentially unefficient
code. It seems much better to provide the index in the vector provided
by the user. If she wants, she can iterate from there to see if the
comms are to be removed, or she can just remove this one and fire
another wait_any.

Maybe less C++ish, but more efficient and not that ugly either.
include/simgrid/s4u/Comm.hpp
teshsuite/s4u/comm-waitany/comm-waitany.cpp