Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
doxygen: uniformity in command markers (@ vs. \)
[simgrid.git] / examples / msg / synchro-semaphore / synchro-semaphore.c
index d62925d..67767ca 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2015. The SimGrid Team.
+/* Copyright (c) 2013-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -11,7 +11,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_semaphore_example, "Messages specific for this
 msg_sem_t sem;
 
 static int peer(int argc, char* argv[]){
-  int i = 0; 
+  int i = 0;
   while(i < argc) {
     double wait_time = xbt_str_parse_double(argv[i],"Invalid wait time: %s");
     i++;
@@ -63,10 +63,11 @@ int main(int argc, char* argv[])
   bobTimes[7] = xbt_strdup("5");
   bobTimes[8] = NULL;
 
-  MSG_process_create_with_arguments(xbt_strdup("Alice"), peer, NULL, h, 8, aliceTimes);
-  MSG_process_create_with_arguments(xbt_strdup("Bob"), peer, NULL, h, 8, bobTimes);
+  MSG_process_create_with_arguments("Alice", peer, NULL, h, 8, aliceTimes);
+  MSG_process_create_with_arguments("Bob", peer, NULL, h, 8, bobTimes);
 
   msg_error_t res = MSG_main();
+  MSG_sem_destroy(sem);
   XBT_INFO("Finished\n");
   return (res != MSG_OK);
 }