X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9a94db9ebea7a49f58308560099411d4ab59b183..5ed37babb2fa9097abe82df299c0aa259ed84d5a:/examples/c/cloud-simple/cloud-simple.c diff --git a/examples/c/cloud-simple/cloud-simple.c b/examples/c/cloud-simple/cloud-simple.c index 6d20bb047b..83e38c2af5 100644 --- a/examples/c/cloud-simple/cloud-simple.c +++ b/examples/c/cloud-simple/cloud-simple.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2023. 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. */ @@ -15,7 +15,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(cloud_simple, "Messages specific for this example"); -static void computation_fun(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[]) +static void computation_fun(int argc, char* argv[]) { const char* pr_name = sg_actor_get_name(sg_actor_self()); const char* host_name = sg_host_get_name(sg_host_self()); @@ -29,8 +29,7 @@ static void computation_fun(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* static void launch_computation_worker(sg_host_t host) { - sg_actor_t actor = sg_actor_init("compute", host); - sg_actor_start(actor, computation_fun, 0, NULL); + sg_actor_create("compute", host, computation_fun, 0, NULL); } struct task_priv { @@ -65,7 +64,7 @@ static void communication_rx_fun(int argc, char* argv[]) XBT_INFO("%s:%s to %s:%s => %g sec", sg_host_get_name(priv->tx_host), sg_actor_get_name(priv->tx_proc), host_name, pr_name, clock_end - priv->clock_sta); - free(priv); + xbt_free(priv); } static void launch_communication_worker(sg_host_t tx_host, sg_host_t rx_host) @@ -73,19 +72,15 @@ static void launch_communication_worker(sg_host_t tx_host, sg_host_t rx_host) char* mbox = bprintf("MBOX:%s-%s", sg_host_get_name(tx_host), sg_host_get_name(rx_host)); const char* tx_argv[] = {"comm_tx", mbox, NULL}; - - sg_actor_t tx = sg_actor_init("comm_tx", tx_host); - sg_actor_start(tx, communication_tx_fun, 2, tx_argv); + sg_actor_create_("comm_tx", tx_host, communication_tx_fun, 2, tx_argv); const char* rx_argv[] = {"comm_rx", mbox, NULL}; - - sg_actor_t rx = sg_actor_init("comm_rx", rx_host); - sg_actor_start(rx, communication_rx_fun, 2, rx_argv); + sg_actor_create_("comm_rx", rx_host, communication_rx_fun, 2, rx_argv); xbt_free(mbox); } -static void master_main(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[]) +static void master_main(int argc, char* argv[]) { sg_host_t pm0 = sg_host_by_name("Fafard"); sg_host_t pm1 = sg_host_by_name("Tremblay"); @@ -237,8 +232,7 @@ int main(int argc, char* argv[]) /* load the platform file */ simgrid_load_platform(argv[1]); - sg_actor_t actor = sg_actor_init("master_", sg_host_by_name("Fafard")); - sg_actor_start(actor, master_main, 0, NULL); + sg_actor_create("master_", sg_host_by_name("Fafard"), master_main, 0, NULL); simgrid_run(); XBT_INFO("Simulation time %g", simgrid_get_clock());