]> git.proxmox.com Git - ceph.git/blame - 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
CommitLineData
7c673cae
FG
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
23namespace compute = boost::compute;
24
b32b8144 25static size_t wait_num = 0;
7c673cae 26
b32b8144
FG
27struct waitable_object
28{
29 void wait()
7c673cae 30 {
b32b8144 31 wait_num++;
7c673cae 32 }
b32b8144 33};
7c673cae 34
b32b8144
FG
35BOOST_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);
7c673cae
FG
49}
50
51BOOST_AUTO_TEST_SUITE_END()