named_mutex_test.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2004-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. #include <boost/interprocess/sync/named_mutex.hpp>
  12. #include <boost/interprocess/sync/scoped_lock.hpp>
  13. #include "mutex_test_template.hpp"
  14. #include "named_creation_template.hpp"
  15. #include <string>
  16. #include <boost/interprocess/detail/interprocess_tester.hpp>
  17. using namespace boost::interprocess;
  18. int main ()
  19. {
  20. try{
  21. named_mutex::remove(test::get_process_id_name());
  22. test::test_named_creation< test::named_sync_creation_test_wrapper<named_mutex> >();
  23. test::test_all_lock< test::named_sync_wrapper<named_mutex> >();
  24. test::test_all_mutex<test::named_sync_wrapper<named_mutex> >();
  25. }
  26. catch(std::exception &ex){
  27. named_mutex::remove(test::get_process_id_name());
  28. std::cout << ex.what() << std::endl;
  29. return 1;
  30. }
  31. named_mutex::remove(test::get_process_id_name());
  32. return 0;
  33. }
  34. #include <boost/interprocess/detail/config_end.hpp>