doc_anonymous_mutex_shared_data.hpp 1.0 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/detail/config_begin.hpp>
  11. //[doc_anonymous_mutex_shared_data
  12. #include <boost/interprocess/sync/interprocess_mutex.hpp>
  13. struct shared_memory_log
  14. {
  15. enum { NumItems = 100 };
  16. enum { LineSize = 100 };
  17. shared_memory_log()
  18. : current_line(0)
  19. , end_a(false)
  20. , end_b(false)
  21. {}
  22. //Mutex to protect access to the queue
  23. boost::interprocess::interprocess_mutex mutex;
  24. //Items to fill
  25. char items[NumItems][LineSize];
  26. int current_line;
  27. bool end_a;
  28. bool end_b;
  29. };
  30. //]
  31. #include <boost/interprocess/detail/config_end.hpp>