X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c1194401ce4a41ff54a7591f4cf33c9ce2756978..d86cccab023b61606ca9009116b4abe54b62a3b6:/examples/python/async-waitany/async-waitany.py diff --git a/examples/python/async-waitany/async-waitany.py b/examples/python/async-waitany/async-waitany.py index 1bc5891a0c..722d678658 100644 --- a/examples/python/async-waitany/async-waitany.py +++ b/examples/python/async-waitany/async-waitany.py @@ -1,10 +1,10 @@ -# Copyright (c) 2010-2019. The SimGrid Team. All rights reserved. +# Copyright (c) 2010-2020. The SimGrid Team. All rights reserved. # # This program is free software; you can redistribute it and/or modify it # under the terms of the license (GNU LGPL) which comes with this package. +from simgrid import Comm, Engine, Mailbox, this_actor import sys -from simgrid import * # This example shows how to block on the completion of a set of communications. # @@ -18,6 +18,7 @@ from simgrid import * # other messages of this application. As expected, the trace shows that the finalize of worker 1 is # processed before 'Message 5' that is sent to worker 0. + class Sender: def __init__(self, *args): if len(args) != 3: @@ -60,10 +61,11 @@ class Sender: # terminated. # Even in this simple example, the pending comms do not terminate in the exact same order of creation. while pending_comms: - changed_pos = Comm.wait_any(pending_comms) - del pending_comms[changed_pos] - if (changed_pos != 0): - this_actor.info("Remove the {:d}th pending comm: it terminated earlier than another comm that was initiated first.".format(changed_pos)); + changed_pos = Comm.wait_any(pending_comms) + del pending_comms[changed_pos] + if (changed_pos != 0): + this_actor.info( + "Remove the {:d}th pending comm: it terminated earlier than another comm that was initiated first.".format(changed_pos)) this_actor.info("Goodbye now!")