A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
docs: move S4U to its own (sub-)page
[simgrid.git]
/
src
/
simix
/
smx_deployment.cpp
diff --git
a/src/simix/smx_deployment.cpp
b/src/simix/smx_deployment.cpp
index
e947067
..
2226ad9
100644
(file)
--- a/
src/simix/smx_deployment.cpp
+++ b/
src/simix/smx_deployment.cpp
@@
-67,6
+67,10
@@
static simgrid::simix::ActorCodeFactory toActorCodeFactory(xbt_main_func_t code)
{
return [code](std::vector<std::string> args) { return simgrid::xbt::wrap_main(code, std::move(args)); };
}
+static simgrid::simix::ActorCodeFactory toActorCodeFactory(void (*code)(std::vector<std::string>))
+{
+ return [code](std::vector<std::string> args) { return std::bind(std::move(code), std::move(args)); };
+}
/**
* @brief Registers a #xbt_main_func_t code in a global table.
@@
-78,8
+82,10
@@
static simgrid::simix::ActorCodeFactory toActorCodeFactory(xbt_main_func_t code)
*/
void SIMIX_function_register(std::string name, xbt_main_func_t code)
{
- xbt_assert(simix_global,
- "SIMIX_global_init has to be called before SIMIX_function_register.");
+ simix_global->registered_functions[name] = toActorCodeFactory(code);
+}
+void SIMIX_function_register(std::string name, void (*code)(std::vector<std::string>))
+{
simix_global->registered_functions[name] = toActorCodeFactory(code);
}