1 /* Copyright (c) 2010-2017. 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 /******************** Non-deterministic message ordering *********************/
7 /* Server assumes a fixed order in the reception of messages from its clients */
8 /* which is incorrect because the message ordering is non-deterministic */
9 /******************************************************************************/
11 #include <simgrid/msg.h>
12 #include <simgrid/modelchecker.h>
16 XBT_LOG_NEW_DEFAULT_CATEGORY(example, "this example");
18 static int server(int argc, char *argv[])
20 msg_task_t task = NULL;
24 MSG_task_destroy(task);
27 MSG_task_receive(&task, "mymailbox");
30 int value_got = xbt_str_parse_int(MSG_task_get_name(task), "Task names must be integers, not '%s'");
31 MC_assert(value_got == 3);
37 static int client(int argc, char *argv[])
39 msg_task_t task = MSG_task_create(argv[1], 0 /*comp cost */ , 10000 /*comm size */ , NULL /*arbitrary data */ );
41 MSG_task_send(task, "mymailbox");
47 int main(int argc, char *argv[])
49 MSG_init(&argc, argv);
51 MSG_create_environment("platform.xml");
53 MSG_function_register("server", server);
54 MSG_function_register("client", client);
55 MSG_launch_application("deploy_bugged1.xml");