From: Pierre Date: Thu, 5 Jan 2012 11:40:35 +0000 (+0100) Subject: Use of busy wait instead of futex if there is not futex.h X-Git-Tag: exp_20120216~198 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/06bee23c2ca4e5d4efaa9f23935c52dd423c7f9b?hp=8667e559c0b101ca2d556645688acf9e85e7f3ef Use of busy wait instead of futex if there is not futex.h --- diff --git a/src/surf/surf_config.c b/src/surf/surf_config.c index 0005033e87..a136ff96c2 100644 --- a/src/surf/surf_config.c +++ b/src/surf/surf_config.c @@ -470,7 +470,11 @@ void surf_config_init(int *argc, char **argv) _surf_cfg_cb_contexts_parallel_threshold, NULL); /* minimal number of user contexts to be run in parallel */ +#ifdef HAVE_FUTEX_H default_value = xbt_strdup("futex"); +#else //No futex on mac and posix is unimplememted yet + default_value = xbt_strdup("busy_wait"); +#endif xbt_cfg_register(&_surf_cfg_set, "contexts/synchro", "Synchronization mode to use when running contexts in parallel (either futex, posix or busy_wait)", xbt_cfgelm_string, &default_value, 1, 1, diff --git a/src/xbt/parmap.c b/src/xbt/parmap.c index 0b922d05b4..0952118b1c 100644 --- a/src/xbt/parmap.c +++ b/src/xbt/parmap.c @@ -445,8 +445,11 @@ XBT_TEST_UNIT("basic", test_parmap_basic, "Basic usage") xbt_dynar_t data = xbt_dynar_new(sizeof(void *), NULL); /* Create the parallel map */ +#ifdef HAVE_FUTEX_H parmap = xbt_parmap_new(10, XBT_PARMAP_FUTEX); - +#else + parmap = xbt_parmap_new(10, XBT_PARMAP_BUSY_WAIT); +#endif for (j = 0; j < 100; j++) { xbt_dynar_push_as(data, void *, (void *)j); }