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
Make SIMIX_req_host_execution_wait to also destroy the execution action when done.
[simgrid.git]
/
src
/
msg
/
gos.c
diff --git
a/src/msg/gos.c
b/src/msg/gos.c
index
2ba0587
..
ace7cc7
100644
(file)
--- a/
src/msg/gos.c
+++ b/
src/msg/gos.c
@@
-38,6
+38,7
@@
MSG_error_t MSG_task_execute(m_task_t task)
{
simdata_task_t simdata = NULL;
m_process_t self = MSG_process_self();
+ e_smx_state_t comp_state;
CHECK_HOST();
simdata = task->simdata;
@@
-64,22
+65,21
@@
MSG_error_t MSG_task_execute(m_task_t task)
simdata->isused=1;
simdata->compute =
SIMIX_req_host_execute(task->name, SIMIX_host_self(),
- simdata->computation_amount
);
-
SIMIX_req_host_execution_set_priority(simdata->compute,
simdata->priority);
+ simdata->computation_amount
,
+
simdata->priority);
#ifdef HAVE_TRACING
SIMIX_req_set_category(simdata->compute, task->category);
#endif
self->simdata->waiting_action = simdata->compute;
- SIMIX_req_host_execution_wait(simdata->compute);
+
comp_state =
SIMIX_req_host_execution_wait(simdata->compute);
self->simdata->waiting_action = NULL;
simdata->isused=0;
- DEBUG2("Execution task '%s' finished in state %d", task->name,
SIMIX_req_host_execution_get_state(task->simdata->compute)
);
- if (
SIMIX_req_host_execution_get_state(task->simdata->compute)
== SIMIX_DONE) {
+ DEBUG2("Execution task '%s' finished in state %d", task->name,
comp_state
);
+ if (
comp_state
== SIMIX_DONE) {
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
- SIMIX_req_host_execution_destroy(task->simdata->compute);
simdata->computation_amount = 0.0;
simdata->comm = NULL;
simdata->compute = NULL;
@@
-89,7
+89,6
@@
MSG_error_t MSG_task_execute(m_task_t task)
MSG_RETURN(MSG_OK);
} else if (SIMIX_req_host_get_state(SIMIX_host_self()) == 0) {
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
- SIMIX_req_host_execution_destroy(task->simdata->compute);
simdata->comm = NULL;
simdata->compute = NULL;
#ifdef HAVE_TRACING
@@
-98,7
+97,6
@@
MSG_error_t MSG_task_execute(m_task_t task)
MSG_RETURN(MSG_HOST_FAILURE);
} else {
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
- SIMIX_req_host_execution_destroy(task->simdata->compute);
simdata->comm = NULL;
simdata->compute = NULL;
#ifdef HAVE_TRACING
@@
-167,6
+165,7
@@
MSG_parallel_task_create(const char *name, int host_nb,
MSG_error_t MSG_parallel_task_execute(m_task_t task)
{
simdata_task_t simdata = NULL;
+ e_smx_state_t comp_state;
m_process_t self = MSG_process_self();
CHECK_HOST();
@@
-191,29
+190,26
@@
MSG_error_t MSG_parallel_task_execute(m_task_t task)
DEBUG1("Parallel execution action created: %p", simdata->compute);
self->simdata->waiting_action = simdata->compute;
- SIMIX_req_host_execution_wait(simdata->compute);
+
comp_state =
SIMIX_req_host_execution_wait(simdata->compute);
self->simdata->waiting_action = NULL;
- DEBUG2("Finished waiting for execution of action %p, state = %d", simdata->compute,
SIMIX_req_host_execution_get_state(task->simdata->compute)
);
+ DEBUG2("Finished waiting for execution of action %p, state = %d", simdata->compute,
comp_state
);
simdata->isused=0;
- if (
SIMIX_req_host_execution_get_state(task->simdata->compute)
== SIMIX_DONE) {
+ if (
comp_state
== SIMIX_DONE) {
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
- SIMIX_req_host_execution_destroy(task->simdata->compute);
simdata->computation_amount = 0.0;
simdata->comm = NULL;
simdata->compute = NULL;
MSG_RETURN(MSG_OK);
} else if (SIMIX_req_host_get_state(SIMIX_host_self()) == 0) {
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
- SIMIX_req_host_execution_destroy(task->simdata->compute);
simdata->comm = NULL;
simdata->compute = NULL;
MSG_RETURN(MSG_HOST_FAILURE);
} else {
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
- SIMIX_req_host_execution_destroy(task->simdata->compute);
simdata->comm = NULL;
simdata->compute = NULL;
MSG_RETURN(MSG_TASK_CANCELLED);
@@
-517,7
+513,8
@@
int MSG_comm_testany(xbt_dynar_t comms)
*/
void MSG_comm_destroy(msg_comm_t comm)
{
- if (SIMIX_req_comm_get_src_proc(comm) != SIMIX_process_self()) {
+ if (SIMIX_req_comm_get_src_proc(comm) != SIMIX_process_self()
+ && MSG_comm_get_status(comm) == MSG_OK) {
m_task_t task;
task = (m_task_t) SIMIX_req_comm_get_src_buff(comm);
task->simdata->isused=0;