Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
956c2f9161bbbf9456f9028112e7ee725479b884
[simgrid.git] / examples / msg / process-create / process-create.c
1 /* Copyright (c) 2010, 2012-2016. The SimGrid Team. All rights reserved.    */
2
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. */
5
6 #include "simgrid/msg.h"
7
8 /* Main function of the process I want to start manually */
9 static int process_function(int argc, char *argv[])
10 {
11   msg_task_t task = MSG_task_create("task", 100, 0, NULL);
12   MSG_task_execute (task);
13   MSG_task_destroy (task);
14   return 0;
15 }
16
17 int main(int argc, char *argv[])
18 {
19   MSG_init(&argc, argv);
20   xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
21
22   MSG_create_environment(argv[1]);
23   MSG_process_create("simple_func", process_function, NULL, MSG_get_host_by_name("Tremblay"));
24   MSG_process_create("simple_func", process_function, NULL, MSG_get_host_by_name("Fafard"));
25
26   MSG_main();
27   return 0;
28 }