Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Populate the kernel::context namespace and continue separating concerns out of simix
[simgrid.git] / src / kernel / activity / Synchro.h
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 #ifndef _SIMIX_SYNCHRO_HPP
7 #define _SIMIX_SYNCHRO_HPP
8
9 #include <string>
10 #include <list>
11
12 #include <xbt/base.h>
13 #include "simgrid/forward.h"
14
15 #ifdef __cplusplus
16
17 #include <simgrid/simix.hpp>
18
19 namespace simgrid {
20 namespace kernel {
21 namespace activity {
22
23   XBT_PUBLIC_CLASS Synchro {
24   public:
25     Synchro();
26     virtual ~Synchro();
27     e_smx_state_t state = SIMIX_WAITING; /* State of the synchro */
28     std::string name;                  /* synchro name if any */
29     std::list<smx_simcall_t> simcalls; /* List of simcalls waiting for this synchro */
30
31     virtual void suspend()=0;
32     virtual void resume()=0;
33     virtual void post() =0; // What to do when a simcall terminates
34
35     void ref();
36     void unref();
37   private:
38     int refcount = 1;
39   };
40 }}} // namespace simgrid::kernel::activity
41 #else /* not C++ */
42
43
44 #endif
45
46 #endif