Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SIMIX_comm_cancel() -> simix::Comm->cancel()
[simgrid.git] / src / simix / SynchroComm.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/SynchroComm.hpp"
7 #include "src/surf/surf_interface.hpp"
8 #include "src/simix/smx_network_private.h"
9 #include "simgrid/modelchecker.h"
10 #include "src/mc/mc_replay.h"
11
12
13 void simgrid::simix::Comm::suspend() {
14   /* FIXME: shall we suspend also the timeout synchro? */
15   if (surf_comm)
16     surf_comm->suspend();
17   /* in the other case, the action will be suspended on creation, in SIMIX_comm_start() */
18
19 }
20
21 void simgrid::simix::Comm::resume() {
22   /*FIXME: check what happen with the timeouts */
23   if (surf_comm)
24     surf_comm->resume();
25   /* in the other case, the synchro were not really suspended yet, see SIMIX_comm_suspend() and SIMIX_comm_start() */
26 }
27
28 void simgrid::simix::Comm::cancel() {
29   /* if the synchro is a waiting state means that it is still in a mbox */
30   /* so remove from it and delete it */
31   if (state == SIMIX_WAITING) {
32     SIMIX_mbox_remove(mbox, this);
33     state = SIMIX_CANCELED;
34   }
35   else if (!MC_is_active() /* when running the MC there are no surf actions */
36            && !MC_record_replay_is_active()
37            && (state == SIMIX_READY || state == SIMIX_RUNNING)) {
38
39     surf_comm->cancel();
40   }
41 }