Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / interprocess / example / doc_anonymous_mutex_shared_data.hpp
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga 2006-2012. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // See http://www.boost.org/libs/interprocess for documentation.
8 //
9 //////////////////////////////////////////////////////////////////////////////
10 #include <boost/interprocess/detail/config_begin.hpp>
11 //[doc_anonymous_mutex_shared_data
12 #include <boost/interprocess/sync/interprocess_mutex.hpp>
13
14 struct shared_memory_log
15 {
16    enum { NumItems = 100 };
17    enum { LineSize = 100 };
18
19    shared_memory_log()
20       :  current_line(0)
21       ,  end_a(false)
22       ,  end_b(false)
23    {}
24
25    //Mutex to protect access to the queue
26    boost::interprocess::interprocess_mutex mutex;
27
28    //Items to fill
29    char   items[NumItems][LineSize];
30    int    current_line;
31    bool   end_a;
32    bool   end_b;
33 };
34 //]
35 #include <boost/interprocess/detail/config_end.hpp>