Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
added ssid for ns3 wifi
[simgrid.git] / examples / python / async-wait / async-wait.py
index 39ab1ea9a66d150f87d847120fcdb4998c49d21d..667f01fc793c818b0c720da770a5be46b70d2a38 100644 (file)
@@ -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 Engine, Mailbox, this_actor
 import sys
-from simgrid import *
 
 # This example shows how to use simgrid::s4u::this_actor::wait() to wait for a given communication.
 #
@@ -60,11 +60,9 @@ class Receiver:
     def __init__(self, *args):
         if len(args) != 1:  # Receiver actor expects 1 argument: its ID
             raise AssertionError("Actor receiver requires 1 parameter, but got {:d}".format(len(args)))
-        self.id = int(args[0])
+        self.mbox = Mailbox.by_name("receiver-{:s}".format(args[0]))
 
     def __call__(self):
-        # FIXME: It should be ok to initialize self.mbox from __init__, but it's currently failing on the OS X Jenkins slave.
-        self.mbox = Mailbox.by_name("receiver-{:d}".format(self.id))
         this_actor.info("Wait for my first message")
         while True:
             received = self.mbox.get()