Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Parmap: add a value XBT_PARMAP_DEFAULT that decides the synchro mode for you
[simgrid.git] / src / xbt / parmap.c
index f7fb43c..9f2f35b 100644 (file)
@@ -120,6 +120,13 @@ void xbt_parmap_destroy(xbt_parmap_t parmap)
  */
 static void xbt_parmap_set_mode(xbt_parmap_t parmap, e_xbt_parmap_mode_t mode)
 {
+  if (mode == XBT_PARMAP_DEFAULT) {
+#ifdef HAVE_FUTEX_H
+    mode = XBT_PARMAP_FUTEX;
+#else
+    mode = XBT_PARMAP_POSIX;
+#endif
+  }
   parmap->mode = mode;
 
   switch (mode) {
@@ -149,6 +156,10 @@ static void xbt_parmap_set_mode(xbt_parmap_t parmap, e_xbt_parmap_mode_t mode)
       parmap->signal_f = xbt_parmap_busy_signal;
       parmap->wait_f = xbt_parmap_busy_wait;
       break;
+
+    case XBT_PARMAP_DEFAULT:
+      THROW_IMPOSSIBLE;
+      break;
   }
 }