XBT_INFO(" Property: %s old value: %s", exist, value);
XBT_INFO("== Trying to modify a host property");
- MSG_host_set_property_value(thehost, exist, xbt_strdup("250"));
+ MSG_host_set_property_value(thehost, exist, (char*)"250");
/* Test if we have changed the value */
value = MSG_host_get_property_value(thehost, exist);
XBT_INFO(" Property: %s old value: %s", exist, value);
/* Restore the value for the next test */
- MSG_host_set_property_value(thehost, exist, xbt_strdup("180"));
+ MSG_host_set_property_value(thehost, exist, (char*)"180");
+
+ xbt_dict_free(&props);
}
static int alice(int argc, char *argv[]) { /* Dump what we have on the current host */
value = MSG_process_get_property_value(MSG_process_self(), noexist);
xbt_assert(!value, "The property is defined (it shouldnt)");
+ xbt_dict_free(&props);
return 0;
}
/* Print the properties of 'host1' */
- xbt_dict_foreach(props, cursor, key, data) {
+ xbt_dict_foreach (props, cursor, key, data)
XBT_INFO("\tProperty: %s has value: %s", key, data);
- }
/* Try to get a property that does not exist */
value = sg_host_get_property_value(h1, noexist);
XBT_INFO("\tProperty: %s has value: %s", noexist, value?value:"Undefined (NULL)");
+ xbt_dict_free(&props);
+
/* Get the property list of 'host2' */
XBT_INFO("Property list for host %s", name2);
props = sg_host_get_properties(h2);
/* Print the properties of 'host2' */
- xbt_dict_foreach(props, cursor, key, data) {
+ xbt_dict_foreach (props, cursor, key, data)
XBT_INFO("\tProperty: %s on host: %s", key, data);
- }
+
+ xbt_dict_free(&props);
/* Modify an existing property test. First check it exists */
XBT_INFO("Modify an existing property");
void sg_platf_new_process(sg_platf_process_cbarg_t process)
{
+ std::map<std::string, std::string> props;
+ if (process->properties) {
+ for (auto elm : *process->properties)
+ props.insert({elm.first, elm.second});
+ delete process->properties;
+ }
sg_host_t host = sg_host_by_name(process->host);
if (not host) {
// The requested host does not exist. Do a nice message to the user
arg->data = nullptr;
arg->host = host;
arg->kill_time = kill_time;
- arg->properties = current_property_set;
+ arg->properties = &props;
host->extension<simgrid::simix::Host>()->boot_processes.push_back(arg);
arg->data = nullptr;
arg->host = host;
arg->kill_time = kill_time;
- arg->properties = current_property_set;
+ arg->properties = &props;
XBT_DEBUG("Process %s@%s will be started at time %f", arg->name.c_str(), arg->host->getCname(), start_time);
SIMIX_timer_set(start_time, [arg, auto_restart]() {
XBT_DEBUG("Starting Process %s(%s) right now", arg->name.c_str(), host->getCname());
smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), std::move(code), nullptr, host,
- current_property_set, nullptr);
+ arg->properties, nullptr);
/* The actor creation will fail if the host is currently dead, but that's fine */
if (actor != nullptr) {