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 "mutex_test_template.hpp"
12 #include "sharable_mutex_test_template.hpp"
13 #include "named_creation_template.hpp"
14 #include <boost/interprocess/sync/named_sharable_mutex.hpp>
16 #include "get_process_id_name.hpp"
18 using namespace boost::interprocess
;
23 { named_sharable_mutex::remove(test::get_process_id_name()); }
26 //This wrapper is necessary to have a default constructor
27 //in generic mutex_test_template functions
28 class named_sharable_mutex_lock_test_wrapper
29 : public named_sharable_mutex
32 named_sharable_mutex_lock_test_wrapper()
33 : named_sharable_mutex(open_or_create
, test::get_process_id_name())
36 ~named_sharable_mutex_lock_test_wrapper()
39 ipcdetail::interprocess_tester::
40 dont_close_on_destruction(static_cast<named_sharable_mutex
&>(*this));
47 int named_sharable_mutex_lock_test_wrapper::count_
= 0;
50 //This wrapper is necessary to have a common constructor
51 //in generic named_creation_template functions
52 class named_sharable_mutex_creation_test_wrapper
53 : public mutex_deleter
, public named_sharable_mutex
56 named_sharable_mutex_creation_test_wrapper
58 : named_sharable_mutex(create_only
, test::get_process_id_name())
61 named_sharable_mutex_creation_test_wrapper
63 : named_sharable_mutex(open_only
, test::get_process_id_name())
66 named_sharable_mutex_creation_test_wrapper
68 : named_sharable_mutex(open_or_create
, test::get_process_id_name())
71 ~named_sharable_mutex_creation_test_wrapper()
74 ipcdetail::interprocess_tester::
75 dont_close_on_destruction(static_cast<named_sharable_mutex
&>(*this));
82 int named_sharable_mutex_creation_test_wrapper::count_
= 0;
87 named_sharable_mutex::remove(test::get_process_id_name());
88 test::test_named_creation
< test::named_sync_creation_test_wrapper
<named_sharable_mutex
> >();
89 test::test_all_lock
< test::named_sync_wrapper
<named_sharable_mutex
> >();
90 test::test_all_mutex
<test::named_sync_wrapper
<named_sharable_mutex
> >();
91 test::test_all_sharable_mutex
<test::named_sync_wrapper
<named_sharable_mutex
> >();
93 catch(std::exception
&ex
){
94 named_sharable_mutex::remove(test::get_process_id_name());
95 std::cout
<< ex
.what() << std::endl
;
98 named_sharable_mutex::remove(test::get_process_id_name());