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
Use std::string for Synchro instead of char*
[simgrid.git]
/
src
/
simix
/
smx_synchro.cpp
diff --git
a/src/simix/smx_synchro.cpp
b/src/simix/smx_synchro.cpp
index
cb9212a
..
67e4eaa
100644
(file)
--- a/
src/simix/smx_synchro.cpp
+++ b/
src/simix/smx_synchro.cpp
@@
-26,7
+26,6
@@
static smx_synchro_t SIMIX_synchro_wait(sg_host_t smx_host, double timeout)
XBT_IN("(%p, %f)",smx_host,timeout);
simgrid::simix::Raw *sync = new simgrid::simix::Raw();
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();
sync->sleep = surf_host_sleep(smx_host, timeout);
sync->sleep->setData(sync);
XBT_OUT();
@@
-64,14
+63,6
@@
void SIMIX_synchro_stop_waiting(smx_process_t process, smx_simcall_t simcall)
XBT_OUT();
}
XBT_OUT();
}
-void SIMIX_synchro_destroy(smx_synchro_t synchro)
-{
- XBT_DEBUG("Destroying synchro %p", synchro);
- simgrid::simix::Raw *raw = static_cast<simgrid::simix::Raw*>(synchro);
-
- delete raw;
-}
-
void SIMIX_synchro_finish(smx_synchro_t synchro)
{
XBT_IN("(%p)",synchro);
void SIMIX_synchro_finish(smx_synchro_t synchro)
{
XBT_IN("(%p)",synchro);
@@
-95,7
+86,7
@@
void SIMIX_synchro_finish(smx_synchro_t synchro)
SIMIX_synchro_stop_waiting(simcall->issuer, simcall);
simcall->issuer->waiting_synchro = NULL;
SIMIX_synchro_stop_waiting(simcall->issuer, simcall);
simcall->issuer->waiting_synchro = NULL;
-
SIMIX_synchro_destroy(synchro)
;
+
delete synchro
;
SIMIX_simcall_answer(simcall);
XBT_OUT();
}
SIMIX_simcall_answer(simcall);
XBT_OUT();
}
@@
-113,7
+104,7
@@
smx_mutex_t simcall_HANDLER_mutex_init(smx_simcall_t simcall){
smx_mutex_t SIMIX_mutex_init(void)
{
XBT_IN("()");
smx_mutex_t SIMIX_mutex_init(void)
{
XBT_IN("()");
- s
_smx_process_t
p; /* useful to initialize sleeping swag */
+ s
imgrid::simix::Process
p; /* useful to initialize sleeping swag */
smx_mutex_t mutex = xbt_new0(s_smx_mutex_t, 1);
mutex->locked = 0;
smx_mutex_t mutex = xbt_new0(s_smx_mutex_t, 1);
mutex->locked = 0;
@@
-199,7
+190,7
@@
void SIMIX_mutex_unlock(smx_mutex_t mutex, smx_process_t issuer)
if (xbt_swag_size(mutex->sleeping) > 0) {
/*process to wake up */
smx_process_t p = (smx_process_t) xbt_swag_extract(mutex->sleeping);
if (xbt_swag_size(mutex->sleeping) > 0) {
/*process to wake up */
smx_process_t p = (smx_process_t) xbt_swag_extract(mutex->sleeping);
-
SIMIX_synchro_destroy(p->waiting_synchro)
;
+
delete p->waiting_synchro
;
p->waiting_synchro = NULL;
mutex->owner = p;
SIMIX_simcall_answer(&p->simcall);
p->waiting_synchro = NULL;
mutex->owner = p;
SIMIX_simcall_answer(&p->simcall);
@@
-239,7
+230,7
@@
void SIMIX_mutex_destroy(smx_mutex_t mutex)
smx_cond_t SIMIX_cond_init(void)
{
XBT_IN("()");
smx_cond_t SIMIX_cond_init(void)
{
XBT_IN("()");
- s
_smx_process_t
p;
+ s
imgrid::simix::Process
p;
smx_cond_t cond = xbt_new0(s_smx_cond_t, 1);
cond->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup));
cond->mutex = NULL;
smx_cond_t cond = xbt_new0(s_smx_cond_t, 1);
cond->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup));
cond->mutex = NULL;
@@
-318,7
+309,7
@@
void SIMIX_cond_signal(smx_cond_t cond)
if ((proc = (smx_process_t) xbt_swag_extract(cond->sleeping))) {
/* Destroy waiter's synchronization */
if ((proc = (smx_process_t) xbt_swag_extract(cond->sleeping))) {
/* Destroy waiter's synchronization */
-
SIMIX_synchro_destroy(proc->waiting_synchro)
;
+
delete proc->waiting_synchro
;
proc->waiting_synchro = NULL;
/* Now transform the cond wait simcall into a mutex lock one */
proc->waiting_synchro = NULL;
/* Now transform the cond wait simcall into a mutex lock one */
@@
-380,7
+371,7
@@
void SIMIX_cond_destroy(smx_cond_t cond)
smx_sem_t SIMIX_sem_init(unsigned int value)
{
XBT_IN("(%u)",value);
smx_sem_t SIMIX_sem_init(unsigned int value)
{
XBT_IN("(%u)",value);
- s
_smx_process_t
p;
+ s
imgrid::simix::Process
p;
smx_sem_t sem = xbt_new0(s_smx_sem_t, 1);
sem->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup));
smx_sem_t sem = xbt_new0(s_smx_sem_t, 1);
sem->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup));
@@
-418,7
+409,7
@@
void SIMIX_sem_release(smx_sem_t sem)
XBT_DEBUG("Sem release semaphore %p", sem);
if ((proc = (smx_process_t) xbt_swag_extract(sem->sleeping))) {
XBT_DEBUG("Sem release semaphore %p", sem);
if ((proc = (smx_process_t) xbt_swag_extract(sem->sleeping))) {
-
SIMIX_synchro_destroy(proc->waiting_synchro)
;
+
delete proc->waiting_synchro
;
proc->waiting_synchro = NULL;
SIMIX_simcall_answer(&proc->simcall);
} else if (sem->value < SMX_SEM_NOLIMIT) {
proc->waiting_synchro = NULL;
SIMIX_simcall_answer(&proc->simcall);
} else if (sem->value < SMX_SEM_NOLIMIT) {