doc_named_condition_shared_data.hpp 1.1 KB

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