/**************************** Process simcalls ********************************/
SG_BEGIN_DECL()
-/* Constructor and Destructor */
-#ifdef __cplusplus
-XBT_PUBLIC smx_actor_t simcall_process_create(std::string name, xbt_main_func_t code, void* data, sg_host_t host,
- int argc, char** argv,
- std::unordered_map<std::string, std::string>* properties);
-#endif
-
XBT_ATTRIB_DEPRECATED_v324("Please use ActorImpl::throw_exception") XBT_PUBLIC
void SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const char* mesg);
* @param argv second argument passed to @a code
* @param properties the properties of the process
*/
-smx_actor_t simcall_process_create(std::string name, xbt_main_func_t code, void* data, sg_host_t host, int argc,
- char** argv, std::unordered_map<std::string, std::string>* properties)
-{
- auto wrapped_code = simgrid::xbt::wrap_main(code, argc, argv);
- for (int i = 0; i != argc; ++i)
- xbt_free(argv[i]);
- xbt_free(argv);
- smx_actor_t res = simcall_process_create(name, std::move(wrapped_code), data, host, properties);
- return res;
-}
-
smx_actor_t simcall_process_create(std::string name, simgrid::simix::ActorCode code, void* data, sg_host_t host,
std::unordered_map<std::string, std::string>* properties)
{
/* We need an extra actor here, so that it can sleep until the end of each test */
static void main_dispatcher()
{
- run_test("sleep", test_sleep);
+ run_test("sleep", static_cast<std::function<void()>>(test_sleep));
run_test("sleep killed at start", test_sleep_kill_begin);
run_test("sleep killed in middle", test_sleep_kill_middle);
/* We cannot kill right at the end of the action because killer actors are always rescheduled to the end of the round
return future;
}
-static int master(int /*argc*/, char** /*argv*/)
+static void master()
{
// Test the simple immediate execution:
XBT_INFO("Start");
XBT_INFO("The future is %s", future.is_ready() ? "ready" : "not ready");
res = future.get();
XBT_INFO("kernel_async with value returned with %i", res);
-
- return 0;
}
}
{
SIMIX_global_init(&argc, argv);
xbt_assert(argc == 2, "Usage: %s platform.xml\n", argv[0]);
- simgrid_register_function("master", example::master);
simgrid_load_platform(argv[1]);
- simcall_process_create("master", example::master, NULL, sg_host_by_name("Tremblay"), 0, NULL, NULL);
+ simcall_process_create("master", example::master, NULL, sg_host_by_name("Tremblay"), NULL);
SIMIX_run();
return 0;
}
/* 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 "simgrid/simix.h"
+#include "simgrid/simix.hpp"
#include "xbt/log.h"
#include <simgrid/engine.h>
return x;
}
-static int master(int argc, char* argv[])
+static void master()
{
XBT_INFO("Launching our nice bugged recursive function...");
unsigned i = 1;
unsigned res = collatz(i, i);
XBT_VERB("collatz(%u, %u) returned %u", i, i, res);
}
- return 0;
}
int main(int argc, char* argv[])
xbt_assert(argc == 2, "Usage: %s platform.xml\n", argv[0]);
- simgrid_register_function("master", master);
simgrid_load_platform(argv[1]);
- simcall_process_create("master", master, NULL, sg_host_by_name("Tremblay"), 0, NULL, NULL);
+ simcall_process_create("master", master, NULL, sg_host_by_name("Tremblay"), NULL);
SIMIX_run();
return 0;