doc_upgradable_mutex_shared_data.hpp 954 B

12345678910111213141516171819202122232425262728293031
  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_upgradable_mutex.hpp>
  11. struct shared_data
  12. {
  13. enum { NumItems = 100 };
  14. enum { LineSize = 100 };
  15. shared_data()
  16. : current_line(0)
  17. , end_a(false)
  18. , end_b(false)
  19. {}
  20. //Mutex to protect access to the queue
  21. boost::interprocess::interprocess_upgradable_mutex upgradable_mutex;
  22. //Items to fill
  23. char items[NumItems][LineSize];
  24. int current_line;
  25. bool end_a;
  26. bool end_b;
  27. };