From db447440ff8973961e1936a6a64ca4971eeeea57 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 7 Aug 2013 10:53:22 +0200 Subject: event/Event{Pipe,FD}: auto-create in constructor Errors are fatal now. This makes the class a lot easier to use. --- src/event/EventPipe.hxx | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/event/EventPipe.hxx') diff --git a/src/event/EventPipe.hxx b/src/event/EventPipe.hxx index 9c9446d8e..86a10b0bb 100644 --- a/src/event/EventPipe.hxx +++ b/src/event/EventPipe.hxx @@ -22,34 +22,22 @@ #include "check.h" -#include - /** * A pipe that can be used to trigger an event to the read side. * - * For optimization purposes, this class does not have a constructor - * or a destructor. + * Errors in the constructor are fatal. */ class EventPipe { int fds[2]; public: -#ifdef NDEBUG - EventPipe() = default; -#else - EventPipe():fds{-1, -1} {}; -#endif + EventPipe(); + ~EventPipe(); EventPipe(const EventPipe &other) = delete; EventPipe &operator=(const EventPipe &other) = delete; - bool Create(); - void Destroy(); - int Get() const { - assert(fds[0] >= 0); - assert(fds[1] >= 0); - return fds[0]; } -- cgit v1.2.3