From: Arnaud Giersch Date: Thu, 3 Aug 2017 11:56:50 +0000 (+0200) Subject: Remove legacy parmap functions. X-Git-Tag: v3_17~262 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/16d96d9570d7d7efe4a0a28d516ca267a7a97d65 Remove legacy parmap functions. --- diff --git a/include/xbt/parmap.h b/include/xbt/parmap.h index 2b75fcd687..d12a2f2ac1 100644 --- a/include/xbt/parmap.h +++ b/include/xbt/parmap.h @@ -9,12 +9,6 @@ #ifndef XBT_PARMAP_H #define XBT_PARMAP_H -#include "xbt/misc.h" /* SG_BEGIN_DECL */ -#include "xbt/function_types.h" -#include "xbt/dynar.h" - -SG_BEGIN_DECL() - /** \addtogroup XBT_parmap * \ingroup XBT_misc * \brief Parallel map. @@ -28,9 +22,6 @@ SG_BEGIN_DECL() * \{ */ -/** \brief Parallel map data type (opaque type) */ -typedef struct s_xbt_parmap *xbt_parmap_t; - /** \brief Synchronization mode of the worker threads of a parmap. */ typedef enum { XBT_PARMAP_POSIX, /**< use POSIX synchronization primitives */ @@ -39,13 +30,6 @@ typedef enum { XBT_PARMAP_DEFAULT /**< futex if available, posix otherwise */ } e_xbt_parmap_mode_t; -XBT_PUBLIC(xbt_parmap_t) xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode); -XBT_PUBLIC(void) xbt_parmap_destroy(xbt_parmap_t parmap); -XBT_PUBLIC(void) xbt_parmap_apply(xbt_parmap_t parmap, void_f_pvoid_t fun, xbt_dynar_t data); -XBT_PUBLIC(void*) xbt_parmap_next(xbt_parmap_t parmap); - /** \} */ -SG_END_DECL() - #endif diff --git a/src/xbt/parmap.cpp b/src/xbt/parmap.cpp index 85145b5f27..c5754e4471 100644 --- a/src/xbt/parmap.cpp +++ b/src/xbt/parmap.cpp @@ -3,66 +3,6 @@ /* 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 "xbt/parmap.h" #include "xbt/log.h" -#include "xbt/parmap.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_parmap, xbt, "parmap: parallel map"); - -/** - * \brief Parallel map structure - */ -typedef struct s_xbt_parmap { - simgrid::xbt::Parmap p; -} s_xbt_parmap_t; - -/** - * \brief Creates a parallel map object - * \param num_workers number of worker threads to create - * \param mode how to synchronize the worker threads - * \return the parmap created - */ -xbt_parmap_t xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode) -{ - return reinterpret_cast(new simgrid::xbt::Parmap(num_workers, mode)); -} - -/** - * \brief Destroys a parmap - * \param parmap the parmap to destroy - */ -void xbt_parmap_destroy(xbt_parmap_t parmap) -{ - delete parmap; -} - -/** - * \brief Applies a list of tasks in parallel. - * \param parmap a parallel map object - * \param fun the function to call in parallel - * \param data each element of this dynar will be passed as an argument to fun - */ -void xbt_parmap_apply(xbt_parmap_t parmap, void_f_pvoid_t fun, xbt_dynar_t data) -{ - if (!xbt_dynar_is_empty(data)) { - void** pdata = (void**)xbt_dynar_get_ptr(data, 0); - std::vector vdata(pdata, pdata + xbt_dynar_length(data)); - parmap->p.apply(fun, vdata); - } -} - -/** - * \brief Returns a next task to process. - * - * Worker threads call this function to get more work. - * - * \return the next task to process, or nullptr if there is no more work - */ -void* xbt_parmap_next(xbt_parmap_t parmap) -{ - try { - return parmap->p.next(); - } catch (std::out_of_range) { - return nullptr; - } -}