#include <utility>
#include <memory>
#include <functional>
-#include <future>
#include <xbt/function_types.h>
#include <xbt/future.hpp>
xbt_dict_t properties,
int auto_restart);
-XBT_PUBLIC(smx_timer_t) SIMIX_timer_set(double date, std::packaged_task<void()> callback);
+XBT_PUBLIC(smx_timer_t) SIMIX_timer_set(double date, simgrid::xbt::Task<void()> callback);
template<class F> inline
XBT_PUBLIC(smx_timer_t) SIMIX_timer_set(double date, F callback)
{
- return SIMIX_timer_set(date, std::packaged_task<void()>(std::move(callback)));
+ return SIMIX_timer_set(date, simgrid::xbt::Task<void()>(std::move(callback)));
}
template<class R, class T> inline
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <functional>
-#include <future>
#include <memory>
#include <signal.h> /* Signal handling */
#include <stdlib.h>
#include "src/internal_config.h"
+#include <xbt/functional.hpp>
+
#include "src/surf/surf_interface.hpp"
#include "src/surf/storage_interface.hpp"
#include "src/surf/xml/platf.hpp"
/** @brief Timer datatype */
typedef struct s_smx_timer {
double date = 0.0;
- std::packaged_task<void()> callback;
+ simgrid::xbt::Task<void()> callback;
s_smx_timer() {}
- s_smx_timer(double date, std::packaged_task<void()> callback)
+ s_smx_timer(double date, simgrid::xbt::Task<void()> callback)
: date(date), callback(std::move(callback)) {}
} s_smx_timer_t;
* \param arg Parameters of the function
*
*/
-smx_timer_t SIMIX_timer_set(double date, void (*function)(void*), void *arg)
+smx_timer_t SIMIX_timer_set(double date, void (*callback)(void*), void *arg)
{
- smx_timer_t timer = new s_smx_timer_t(date,
- std::packaged_task<void()>(std::bind(function, arg)));
+ smx_timer_t timer = new s_smx_timer_t(date, [=](){ callback(arg); });
xbt_heap_push(simix_timers, timer, date);
return timer;
}
-smx_timer_t SIMIX_timer_set(double date, std::packaged_task<void()> callback)
+smx_timer_t SIMIX_timer_set(double date, simgrid::xbt::Task<void()> callback)
{
smx_timer_t timer = new s_smx_timer_t(date, std::move(callback));
xbt_heap_push(simix_timers, timer, date);