1 /* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "simgrid/actor.h"
7 #include "simgrid/engine.h"
9 #include "xbt/asserts.h"
12 #include <stdio.h> /* snprintf */
14 XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Messages specific for this example");
16 /* Executed on actor termination*/
17 static void my_onexit(int ignored1, void* ignored2)
19 XBT_INFO("Exiting now (done sleeping or got killed)."); /* - Just display an informative message (see tesh file) */
22 /* Just sleep until termination */
23 static void sleeper(int argc, char* argv[])
25 sg_actor_on_exit(my_onexit, NULL);
27 XBT_INFO("Hello! I go to sleep.");
28 sg_actor_sleep_for(10);
29 XBT_INFO("Done sleeping.");
32 int main(int argc, char* argv[])
34 simgrid_init(&argc, argv);
36 "Usage: %s platform_file deployment_file\n"
37 "\tExample: %s platform.xml deployment.xml\n",
40 simgrid_load_platform(argv[1]); /* - Load the platform description */
41 simgrid_register_function("sleeper", sleeper);
42 simgrid_load_deployment(argv[2]); /* - Deploy the sleeper actors with explicit start/kill times */
44 simgrid_run(); /* - Run the simulation */