1 //////////////////////////////////////////////////////////////////////////////
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)
7 // See http://www.boost.org/libs/interprocess for documentation.
9 //////////////////////////////////////////////////////////////////////////////
11 #include <boost/interprocess/detail/config_begin.hpp>
12 #include "mutex_test_template.hpp"
13 #include "sharable_mutex_test_template.hpp"
14 #include "named_creation_template.hpp"
15 #include <boost/interprocess/sync/named_upgradable_mutex.hpp>
17 #include "get_process_id_name.hpp"
19 using namespace boost::interprocess
;
24 { named_upgradable_mutex::remove(test::get_process_id_name()); }
27 //This wrapper is necessary to have a default constructor
28 //in generic mutex_test_template functions
29 class named_upgradable_mutex_lock_test_wrapper
30 : public named_upgradable_mutex
33 named_upgradable_mutex_lock_test_wrapper()
34 : named_upgradable_mutex(open_or_create
, test::get_process_id_name())
37 ~named_upgradable_mutex_lock_test_wrapper()
40 ipcdetail::interprocess_tester::
41 dont_close_on_destruction(static_cast<named_upgradable_mutex
&>(*this));
48 int named_upgradable_mutex_lock_test_wrapper::count_
= 0;
51 //This wrapper is necessary to have a common constructor
52 //in generic named_creation_template functions
53 class named_upgradable_mutex_creation_test_wrapper
54 : public mutex_deleter
, public named_upgradable_mutex
57 named_upgradable_mutex_creation_test_wrapper
59 : named_upgradable_mutex(create_only
, test::get_process_id_name())
62 named_upgradable_mutex_creation_test_wrapper
64 : named_upgradable_mutex(open_only
, test::get_process_id_name())
67 named_upgradable_mutex_creation_test_wrapper
69 : named_upgradable_mutex(open_or_create
, test::get_process_id_name())
72 ~named_upgradable_mutex_creation_test_wrapper()
75 ipcdetail::interprocess_tester::
76 dont_close_on_destruction(static_cast<named_upgradable_mutex
&>(*this));
83 int named_upgradable_mutex_creation_test_wrapper::count_
= 0;
88 named_upgradable_mutex::remove(test::get_process_id_name());
89 test::test_named_creation
< test::named_sync_creation_test_wrapper
<named_upgradable_mutex
> >();
90 test::test_all_lock
< test::named_sync_wrapper
<named_upgradable_mutex
> >();
91 test::test_all_mutex
<test::named_sync_wrapper
<named_upgradable_mutex
> >();
92 test::test_all_sharable_mutex
<test::named_sync_wrapper
<named_upgradable_mutex
> >();
94 catch(std::exception
&ex
){
95 named_upgradable_mutex::remove(test::get_process_id_name());
96 std::cout
<< ex
.what() << std::endl
;
99 named_upgradable_mutex::remove(test::get_process_id_name());
103 #include <boost/interprocess/detail/config_end.hpp>