Apply patch for [CVE-2012-2677][boost] ordered_malloc() overflow
[external/boost.git] / libs / interprocess / example / doc_named_condition_shared_data.hpp
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga 2006-2009. 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/sync/interprocess_mutex.hpp>
11    #include <boost/interprocess/sync/interprocess_condition.hpp>
12
13    struct trace_queue
14    {
15       enum { LineSize = 100 };
16
17       trace_queue()
18          :  message_in(false)
19       {}
20
21       //Mutex to protect access to the queue
22       boost::interprocess::interprocess_mutex      mutex;
23
24       //Condition to wait when the queue is empty
25       boost::interprocess::interprocess_condition  cond_empty;
26
27       //Condition to wait when the queue is full
28       boost::interprocess::interprocess_condition  cond_full;
29
30       //Items to fill
31       char   items[LineSize];
32
33       //Is there any message
34       bool message_in;
35    };