Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Separate ConditionVariableImpl into its own files
[simgrid.git] / src / kernel / activity / ConditionVariableImpl.hpp
1 /* Copyright (c) 2012-2018. 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 SIMGRID_KERNEL_ACTIVITY_CONDITIONVARIABLEIMPL_HPP
7 #define SIMGRID_KERNEL_ACTIVITY_CONDITIONVARIABLEIMPL_HPP
8
9 #include "simgrid/s4u/ConditionVariable.hpp"
10 #include "src/simix/ActorImpl.hpp"
11 #include <boost/intrusive/list.hpp>
12
13 struct s_smx_cond_t {
14   s_smx_cond_t() : cond_(this) {}
15
16   std::atomic_int_fast32_t refcount_{1};
17   smx_mutex_t mutex = nullptr;
18   simgrid::kernel::actor::SynchroList sleeping; /* list of sleeping processes */
19   simgrid::s4u::ConditionVariable cond_;
20 };
21
22 XBT_PRIVATE smx_cond_t SIMIX_cond_init();
23 XBT_PRIVATE void SIMIX_cond_broadcast(smx_cond_t cond);
24 XBT_PRIVATE void SIMIX_cond_signal(smx_cond_t cond);
25 XBT_PRIVATE void intrusive_ptr_add_ref(s_smx_cond_t* cond);
26 XBT_PRIVATE void intrusive_ptr_release(s_smx_cond_t* cond);
27
28 #endif