simcalls = xbt_fifo_new();
}
-simgrid::simix::Synchro::~Synchro() {
+simgrid::simix::Synchro::~Synchro()
+{
xbt_fifo_free(simcalls);
- xbt_free(name);
}
void simgrid::simix::Synchro::ref()
#ifndef _SIMIX_SYNCHRO_HPP
#define _SIMIX_SYNCHRO_HPP
+#include <string>
+
#include <xbt/base.h>
#include "simgrid/forward.h"
Synchro();
virtual ~Synchro();
e_smx_state_t state; /* State of the synchro */
- char *name = nullptr; /* synchro name if any */
+ std::string name; /* synchro name if any */
xbt_fifo_t simcalls; /* List of simcalls waiting for this synchro */
char *category = nullptr; /* For instrumentation */
simgrid::simix::Exec::Exec(const char*name, sg_host_t hostarg)
{
- name = xbt_strdup(name);
- state = SIMIX_RUNNING;
- host = hostarg;
+ this->name = name;
+ this->state = SIMIX_RUNNING;
+ this->host = hostarg;
}
+
simgrid::simix::Exec::~Exec()
{
if (surf_exec)
XBT_INFO("Process %lu (%s@%s): waiting for %s synchro %p (%s) in state %d to finish",
process->pid, process->name.c_str(), sg_host_get_name(process->host),
synchro_description, process->waiting_synchro,
- process->waiting_synchro->name, (int)process->waiting_synchro->state);
+ process->waiting_synchro->name.c_str(), (int)process->waiting_synchro->state);
}
else {
XBT_INFO("Process %lu (%s@%s)", process->pid, process->name.c_str(), sg_host_get_name(process->host));
}
}
- XBT_DEBUG("Create execute synchro %p: %s", exec, exec->name);
+ XBT_DEBUG("Create execute synchro %p: %s", exec, exec->name.c_str());
return exec;
}
simgrid::simix::Io *synchro = new simgrid::simix::Io();
- synchro->name = NULL;
synchro->host = host;
synchro->surf_io = surf_host_read(host, fd->surf_file, size);
THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host));
simgrid::simix::Io *synchro = new simgrid::simix::Io();
- synchro->name = NULL;
synchro->host = host;
synchro->surf_io = surf_host_write(host, fd->surf_file, size);
synchro->surf_io->setData(synchro);
THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host));
simgrid::simix::Io *synchro = new simgrid::simix::Io();
- synchro->name = NULL;
synchro->host = host;
synchro->surf_io = surf_host_open(host, fullpath);
synchro->surf_io->setData(synchro);
THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host));
simgrid::simix::Io *synchro = new simgrid::simix::Io();
- synchro->name = NULL;
synchro->host = host;
synchro->surf_io = surf_host_close(host, fd->surf_file);
synchro->surf_io->setData(synchro);
THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host));
simgrid::simix::Sleep *synchro = new simgrid::simix::Sleep();
- synchro->name = NULL;
-
synchro->host = host;
synchro->surf_sleep = surf_host_sleep(host, duration);
synchro->surf_sleep->setData(synchro);
XBT_IN("(%p, %f)",smx_host,timeout);
simgrid::simix::Raw *sync = new simgrid::simix::Raw();
- sync->name = nullptr;
sync->sleep = surf_host_sleep(smx_host, timeout);
sync->sleep->setData(sync);
XBT_OUT();