Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simcall_execution_destroy() -> simgrid::simix::Exec::unref()
[simgrid.git] / src / simix / SynchroExec.cpp
1 /* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved.          */
2
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. */
5
6 #include "src/simix/SynchroExec.hpp"
7 #include "src/surf/surf_interface.hpp"
8
9 void simgrid::simix::Exec::suspend()
10 {
11   if (surf_exec)
12     surf_exec->suspend();
13 }
14
15 void simgrid::simix::Exec::resume()
16 {
17   if (surf_exec)
18     surf_exec->resume();
19 }
20
21 double simgrid::simix::Exec::remains()
22 {
23   if (state == SIMIX_RUNNING)
24     return surf_exec->getRemains();
25
26   return 0;
27 }
28
29 void simgrid::simix::Exec::unref()
30 {
31   refcount--;
32   if (refcount > 0)
33     return;
34
35   if (surf_exec)
36     surf_exec->unref();
37
38   delete this;
39 }