eventfd must be marked explicit to prevent erroneous implicit
conversions.
A destructor is provided since other special member functions are
defined (see cppcoreguidelines-special-member-functions).
file_descriptor's constructor is replaced by a trivial constructor.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1623a2f8db0d613201a534293f5e1476b779283c
class eventfd : public file_descriptor {
public:
/* Throws a posix_error exception on failure to create the underlying resource. */
- eventfd(bool use_semaphore_semantics = true, std::uint64_t initial_value = 0);
+ explicit eventfd(bool use_semaphore_semantics = true, std::uint64_t initial_value = 0);
eventfd(const eventfd&) = delete;
eventfd& operator=(const eventfd&) = delete;
eventfd(eventfd&&) = delete;
void operator=(eventfd&&) = delete;
+ ~eventfd() = default;
/* Throws on error. */
void increment(std::uint64_t value = 1);
}
} // anonymous namespace
-lttng::file_descriptor::file_descriptor() noexcept
-{
-}
-
lttng::file_descriptor::file_descriptor(int raw_fd) noexcept : _raw_fd{ raw_fd }
{
LTTNG_ASSERT(is_valid_fd(_raw_fd));
/* RAII wrapper around a UNIX file descriptor. */
class file_descriptor {
public:
- file_descriptor() noexcept;
+ file_descriptor() noexcept = default;
explicit file_descriptor(int raw_fd) noexcept;
file_descriptor(const file_descriptor&) = delete;