]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/test/test_async_wait_guard.cpp
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013-2015 Kyle Lutz <kyle.r.lutz@gmail.com>
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
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 #define BOOST_TEST_MODULE TestAsyncWaitGuard
12 #include <boost/test/unit_test.hpp>
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>
20 #include "check_macros.hpp"
21 #include "context_setup.hpp"
23 namespace compute
= boost::compute
;
25 static size_t wait_num
= 0;
27 struct waitable_object
35 BOOST_AUTO_TEST_CASE(wait_guard_test
)
37 waitable_object waitable
;
39 BOOST_CHECK(wait_num
== 0);
41 compute::wait_guard
<waitable_object
> waitable_object_guard(waitable
);
43 BOOST_CHECK(wait_num
== 1);
45 compute::wait_guard
<waitable_object
> waitable_object_guard1(waitable
);
46 compute::wait_guard
<waitable_object
> waitable_object_guard2(waitable
);
48 BOOST_CHECK(wait_num
== 3);
51 BOOST_AUTO_TEST_SUITE_END()