Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use s4u.
[simgrid.git] / src / xbt / xbt_os_synchro.cpp
index 8973885..4e38f7e 100644 (file)
@@ -1,16 +1,16 @@
 /* Classical synchro schema, implemented on top of SimGrid                  */
 
-/* Copyright (c) 2007-2016. The SimGrid Team.
+/* Copyright (c) 2007-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include "simgrid/simix.h" /* used implementation */
+#include "src/kernel/activity/ConditionVariableImpl.hpp"
 #include "xbt/ex.hpp"
 #include "xbt/synchro.h"
 
-#include "simgrid/simix.h" /* used implementation */
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync, xbt, "Synchronization mechanism");
 
 /****** mutex related functions ******/
@@ -58,7 +58,7 @@ int xbt_cond_timedwait(xbt_cond_t cond, xbt_mutex_t mutex, double delay)
     if (e.category == timeout_error) {
       return 1;
     } else {
-      throw e; // unknown exception
+      throw; // rethrow the exceptions that I don't know
     }
   }
   return 0;
@@ -66,15 +66,15 @@ int xbt_cond_timedwait(xbt_cond_t cond, xbt_mutex_t mutex, double delay)
 
 void xbt_cond_signal(xbt_cond_t cond)
 {
-  simcall_cond_signal((smx_cond_t)cond);
+  cond->cond_.notify_one();
 }
 
 void xbt_cond_broadcast(xbt_cond_t cond)
 {
-  simcall_cond_broadcast((smx_cond_t)cond);
+  cond->cond_.notify_all();
 }
 
 void xbt_cond_destroy(xbt_cond_t cond)
 {
-  SIMIX_cond_unref((smx_cond_t)cond);
+  delete cond;
 }