1 /* Copyright (c) 2010-2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "simgrid/msg.h"
9 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
11 static int slave(int argc, char *argv[])
13 XBT_INFO("Slave started");
15 XBT_INFO("I'm done. See you!");
19 static int master(int argc, char *argv[])
21 msg_process_t process;
23 XBT_INFO("Start slave");
24 process = MSG_process_create("slave from master", slave, NULL, MSG_host_self());
25 XBT_INFO("Join the slave (timeout 2)");
26 MSG_process_join(process, 2);
28 XBT_INFO("Start slave");
29 process = MSG_process_create("slave from master", slave, NULL, MSG_host_self());
30 XBT_INFO("Join the slave (timeout 4)");
31 MSG_process_join(process, 4);
33 XBT_INFO("Start slave");
34 process = MSG_process_create("slave from master", slave, NULL, MSG_host_self());
35 XBT_INFO("Join the slave (timeout 2)");
36 MSG_process_join(process, 2);
38 XBT_INFO("Goodbye now!");
42 XBT_INFO("Goodbye now!");
46 int main(int argc, char *argv[])
50 MSG_init(&argc, argv);
51 xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
53 MSG_create_environment(argv[1]);
55 MSG_process_create("master", master, NULL, MSG_get_host_by_name("Tremblay"));
59 XBT_INFO("Simulation time %g", MSG_get_clock());