]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/test/test_async_wait_guard.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / compute / test / test_async_wait_guard.cpp
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013-2015 Kyle Lutz <kyle.r.lutz@gmail.com>
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
10
11 #define BOOST_TEST_MODULE TestAsyncWaitGuard
12 #include <boost/test/unit_test.hpp>
13
14 #include <boost/compute/async/future.hpp>
15 #include <boost/compute/async/wait_guard.hpp>
16 #include <boost/compute/algorithm/copy.hpp>
17 #include <boost/compute/algorithm/fill.hpp>
18 #include <boost/compute/container/vector.hpp>
19
20 #include "check_macros.hpp"
21 #include "context_setup.hpp"
22
23 namespace compute = boost::compute;
24
25 static size_t wait_num = 0;
26
27 struct waitable_object
28 {
29 void wait()
30 {
31 wait_num++;
32 }
33 };
34
35 BOOST_AUTO_TEST_CASE(wait_guard_test)
36 {
37 waitable_object waitable;
38
39 BOOST_CHECK(wait_num == 0);
40 {
41 compute::wait_guard<waitable_object> waitable_object_guard(waitable);
42 }
43 BOOST_CHECK(wait_num == 1);
44 {
45 compute::wait_guard<waitable_object> waitable_object_guard1(waitable);
46 compute::wait_guard<waitable_object> waitable_object_guard2(waitable);
47 }
48 BOOST_CHECK(wait_num == 3);
49 }
50
51 BOOST_AUTO_TEST_SUITE_END()