libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
shared_mem_struct.hpp
Go to the documentation of this file.
1 #ifndef LIBJMMCG_EXAMPLES_SHARED_MEM_STRUCT_HPP
2 #define LIBJMMCG_EXAMPLES_SHARED_MEM_STRUCT_HPP
3 
4 /******************************************************************************
5 ** Copyright © 2019 by J.M.McGuiness, coder@hussar.me.uk
6 **
7 ** This library is free software; you can redistribute it and/or
8 ** modify it under the terms of the GNU Lesser General Public
9 ** License as published by the Free Software Foundation; either
10 ** version 2.1 of the License, or (at your option) any later version.
11 **
12 ** This library is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ** Lesser General Public License for more details.
16 **
17 ** You should have received a copy of the GNU Lesser General Public
18 ** License along with this library; if not, write to the Free Software
19 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21 
22 #include "core/config.h"
23 
24 #include <array>
25 #include <atomic>
26 
27 namespace jmmcg { namespace LIBJMMCG_VER_NAMESPACE {
28 
29 struct shared_data {
30  std::atomic<bool> exit_child{false}; ///< Used to signal that the sub-process should exit.
31  std::atomic<bool> subproc_started{false}; ///< Used to indicate that the sub-process has started and is ready to communicate.
32  std::atomic<bool> changed{false}; ///< Used to signal that the data, below has been changed in some arbitrary manner.
33  bool ping{false};
34  bool pong{false};
35  std::array<std::uint64_t, 1024> data;
36 };
37 
38 } }
39 
40 #endif