1 /* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "src/simix/SynchroExec.hpp"
7 #include "src/surf/surf_interface.hpp"
8 #include "src/simix/smx_host_private.h"
10 simgrid::simix::Exec::Exec(const char*name, sg_host_t hostarg)
14 this->state = SIMIX_RUNNING;
18 simgrid::simix::Exec::~Exec()
23 void simgrid::simix::Exec::suspend()
29 void simgrid::simix::Exec::resume()
35 double simgrid::simix::Exec::remains()
37 if (state == SIMIX_RUNNING)
38 return surf_exec->getRemains();
43 void simgrid::simix::Exec::post()
45 if (host && host->isOff()) {/* FIMXE: handle resource failure for parallel tasks too */
46 /* If the host running the synchro failed, notice it. This way, the asking
47 * process can be killed if it runs on that host itself */
49 } else if (surf_exec->getState() == simgrid::surf::Action::State::failed) {
50 /* If the host running the synchro didn't fail, then the synchro was canceled */
51 state = SIMIX_CANCELED;
61 /* If there are simcalls associated with the synchro, then answer them */
62 if (xbt_fifo_size(simcalls))
63 SIMIX_execution_finish(this);