Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix missing doc for Tasks
[simgrid.git] / examples / c / actor-suspend / actor-suspend.c
index 604dfc0..d38034d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2020. The SimGrid Team.
+/* Copyright (c) 2007-2023. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -13,8 +13,8 @@
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(actor_suspend, "Messages specific for this example");
 
-/* The Lazy guy only wants to sleep, but can be awaken by the dream_master process. */
-static void lazy_guy(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
+/* The Lazy guy only wants to sleep, but can be awaken by the dream_master actor. */
+static void lazy_guy(int argc, char* argv[])
 {
   XBT_INFO("Nobody's watching me ? Let's go to sleep.");
   sg_actor_suspend(sg_actor_self()); /* - Start by suspending itself */
@@ -35,11 +35,10 @@ static void lazy_guy(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
 }
 
 /* The Dream master: */
-static void dream_master(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
+static void dream_master(int argc, char* argv[])
 {
-  XBT_INFO("Let's create a lazy guy."); /* - Create a lazy_guy process */
-  sg_actor_t lazy = sg_actor_init("Lazy", sg_host_self());
-  sg_actor_start(lazy, lazy_guy, 0, NULL);
+  XBT_INFO("Let's create a lazy guy."); /* - Create a lazy_guy actor */
+  sg_actor_t lazy = sg_actor_create("Lazy", sg_host_self(), lazy_guy, 0, NULL);
   XBT_INFO("Let's wait a little bit...");
   sg_actor_sleep_for(10.0); /* - Wait for 10 seconds */
   XBT_INFO("Let's wake the lazy guy up! >:) BOOOOOUUUHHH!!!!");
@@ -74,13 +73,12 @@ static void dream_master(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* arg
 int main(int argc, char* argv[])
 {
   simgrid_init(&argc, argv);
-  xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
+  xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s platform.xml\n", argv[0], argv[0]);
 
   simgrid_load_platform(argv[1]);
   simgrid_register_function("dream_master", dream_master);
 
-  sg_actor_t actor = sg_actor_init("dream_master", sg_host_by_name("Boivin"));
-  sg_actor_start(actor, dream_master, 0, NULL);
+  sg_actor_create("dream_master", sg_host_by_name("Boivin"), dream_master, 0, NULL);
 
   simgrid_run();