Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill 2 more empty functions: simcall_process_get_name & SIMIX_process_get_name
[simgrid.git] / src / simix / smx_synchro_private.h
index 338a0b4..25c898b 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2012, 2014. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2012-2016. 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. */
@@ -9,7 +8,8 @@
 
 #include <atomic>
 
-#include <simgrid/s4u/mutex.hpp>
+#include <simgrid/s4u/Mutex.hpp>
+#include <simgrid/s4u/conditionVariable.hpp>
 
 #include "xbt/base.h"
 #include "xbt/swag.h"
@@ -62,9 +62,12 @@ private:
 }
 
 typedef struct s_smx_cond {
-  smx_mutex_t mutex;
-  xbt_swag_t sleeping;          /* list of sleeping process */
-  std::atomic_int_fast32_t refcount_;
+  s_smx_cond() : cond_(this) {}
+
+  std::atomic_int_fast32_t refcount_ { 1 };
+  smx_mutex_t mutex = nullptr;
+  xbt_swag_t sleeping = nullptr;  /* list of sleeping process */
+  simgrid::s4u::ConditionVariable cond_;
 } s_smx_cond_t;
 
 typedef struct s_smx_sem {
@@ -72,8 +75,6 @@ typedef struct s_smx_sem {
   xbt_swag_t sleeping;          /* list of sleeping process */
 } s_smx_sem_t;
 
-
-
 XBT_PRIVATE void SIMIX_post_synchro(smx_synchro_t synchro);
 XBT_PRIVATE void SIMIX_synchro_stop_waiting(smx_process_t process, smx_simcall_t simcall);
 XBT_PRIVATE void SIMIX_synchro_destroy(smx_synchro_t synchro);