Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / interprocess / example / doc_anonymous_condition_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_condition_shared_data
12 #include <boost/interprocess/sync/interprocess_mutex.hpp>
13 #include <boost/interprocess/sync/interprocess_condition.hpp>
14
15 struct trace_queue
16 {
17    enum { LineSize = 100 };
18
19    trace_queue()
20       :  message_in(false)
21    {}
22
23    //Mutex to protect access to the queue
24    boost::interprocess::interprocess_mutex      mutex;
25
26    //Condition to wait when the queue is empty
27    boost::interprocess::interprocess_condition  cond_empty;
28
29    //Condition to wait when the queue is full
30    boost::interprocess::interprocess_condition  cond_full;
31
32    //Items to fill
33    char   items[LineSize];
34
35    //Is there any message
36    bool message_in;
37 };
38 //]
39 #include <boost/interprocess/detail/config_end.hpp>