/usr/include/boost/thread/detail/counter.hpp is in libboost1.54-dev 1.54.0-4ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// (C) Copyright 2013 Vicente J. Botet Escriba
#ifndef BOOST_THREAD_COUNTER_HPP
#define BOOST_THREAD_COUNTER_HPP
#include <boost/thread/detail/config.hpp>
#include <boost/thread/detail/delete.hpp>
//#include <boost/thread/mutex.hpp>
//#include <boost/thread/lock_types.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/chrono/duration.hpp>
#include <boost/chrono/time_point.hpp>
#include <boost/assert.hpp>
#include <boost/config/abi_prefix.hpp>
namespace boost
{
namespace detail {
struct counter
{
condition_variable cond_;
std::size_t value_;
counter(std::size_t value)
: value_(value)
{
}
counter& operator=(counter const& rhs)
{
value_ = rhs.value_;
return *this;
}
counter& operator=(std::size_t value)
{
value_ = value;
return *this;
}
operator std::size_t() const
{
return value_;
}
operator std::size_t&()
{
return value_;
}
void inc_and_notify_all()
{
++value_;
cond_.notify_all();
}
void dec_and_notify_all()
{
--value_;
cond_.notify_all();
}
void assign_and_notify_all(counter const& rhs)
{
value_ = rhs.value_;
cond_.notify_all();
}
void assign_and_notify_all(std::size_t value)
{
value_ = value;
cond_.notify_all();
}
};
struct counter_is_not_zero
{
counter_is_not_zero(const counter& count) : count_(count) {}
bool operator()() const { return count_ != 0; }
const counter& count_;
};
struct counter_is_zero
{
counter_is_zero(const counter& count) : count_(count) {}
bool operator()() const { return count_ == 0; }
const counter& count_;
};
}
} // namespace boost
#include <boost/config/abi_suffix.hpp>
#endif
|