doc_anonymous_condition_shared_data.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. struct trace_queue
  15. {
  16. enum { LineSize = 100 };
  17. trace_queue()
  18. : message_in(false)
  19. {}
  20. //Mutex to protect access to the queue
  21. boost::interprocess::interprocess_mutex mutex;
  22. //Condition to wait when the queue is empty
  23. boost::interprocess::interprocess_condition cond_empty;
  24. //Condition to wait when the queue is full
  25. boost::interprocess::interprocess_condition cond_full;
  26. //Items to fill
  27. char items[LineSize];
  28. //Is there any message
  29. bool message_in;
  30. };
  31. //]
  32. #include <boost/interprocess/detail/config_end.hpp>