void simcall_run_kernel(std::function<void()> const& code)
{
- return simcall_BODY_run_kernel((void*) &code);
+ return simcall_BODY_run_kernel(&code);
}
int simcall_mc_random(int min, int max) {
synchro->post();
}
-void SIMIX_run_kernel(void* code)
+void SIMIX_run_kernel(std::function<void()> const* code)
{
- std::function<void()>* function = (std::function<void()>*) code;
- (*function)();
+ (*code)();
}
simgrid::simix::marshal<const char*>(simcall->args[1], arg);
}
-static inline void* simcall_run_kernel__get__code(smx_simcall_t simcall) {
- return simgrid::simix::unmarshal<void*>(simcall->args[0]);
+static inline std::function<void()> const* simcall_run_kernel__get__code(smx_simcall_t simcall) {
+ return simgrid::simix::unmarshal<std::function<void()> const*>(simcall->args[0]);
}
-static inline void simcall_run_kernel__set__code(smx_simcall_t simcall, void* arg) {
- simgrid::simix::marshal<void*>(simcall->args[0], arg);
+static inline void simcall_run_kernel__set__code(smx_simcall_t simcall, std::function<void()> const* arg) {
+ simgrid::simix::marshal<std::function<void()> const*>(simcall->args[0], arg);
}
/* The prototype of all simcall handlers, automatically generated for you */
* That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :)
*/
+#include <functional>
#include "smx_private.h"
#include "src/mc/mc_forward.hpp"
#include "xbt/ex.h"
return simcall<void, smx_synchro_t, const char*>(SIMCALL_SET_CATEGORY, synchro, category);
}
-inline static void simcall_BODY_run_kernel(void* code) {
+inline static void simcall_BODY_run_kernel(std::function<void()> const* code) {
/* Go to that function to follow the code flow through the simcall barrier */
if (0) SIMIX_run_kernel(code);
- return simcall<void, void*>(SIMCALL_RUN_KERNEL, code);
+ return simcall<void, std::function<void()> const*>(SIMCALL_RUN_KERNEL, code);
}/** @endcond */
break;
case SIMCALL_RUN_KERNEL:
- SIMIX_run_kernel(simgrid::simix::unmarshal<void*>(simcall->args[0]));
+ SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall->args[0]));
SIMIX_simcall_answer(simcall);
break;
case NUM_SIMCALLS:
XBT_PRIVATE void SIMIX_simcall_handle(smx_simcall_t, int);
XBT_PRIVATE void SIMIX_simcall_exit(smx_synchro_t);
XBT_PRIVATE const char *SIMIX_simcall_name(e_smx_simcall_t kind);
-XBT_PRIVATE void SIMIX_run_kernel(void* code);
+XBT_PRIVATE void SIMIX_run_kernel(std::function<void()> const* code);
SG_END_DECL()
int mc_random(int min, int max);
void set_category(smx_synchro_t synchro, const char* category) [[nohandler]];
-void run_kernel(void* code) [[nohandler]];
+void run_kernel(std::function<void()> const* code) [[nohandler]];
if line.startswith('#') or not line:
continue
match = re.match(
- r'^(\S+)\s+([^\)\(\s]+)\s*\(*([^\(\)]*)\)\s*(\[\[.*\]\])?\s*;\s*?$', line)
+ r'^(\S+)\s+([^\)\(\s]+)\s*\(*(.*)\)\s*(\[\[.*\]\])?\s*;\s*?$', line)
assert match, line
ret, name, args, attrs = match.groups()
sargs = []
# smx_popping_bodies.cpp
#
fd = header('popping_bodies.cpp')
+ fd.write('#include <functional>\n')
fd.write('#include "smx_private.h"\n')
fd.write('#include "src/mc/mc_forward.hpp"\n')
fd.write('#include "xbt/ex.h"\n')