aboutsummaryrefslogtreecommitdiffstats
path: root/src/event/EventFD.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-08-07 10:53:22 +0200
committerMax Kellermann <max@duempel.org>2013-08-07 10:53:22 +0200
commitdb447440ff8973961e1936a6a64ca4971eeeea57 (patch)
treed8208496bbc8d80f614f02998580007b34a987d0 /src/event/EventFD.hxx
parentb70d38dc10868a7ddfac2df7001be36fc37fc21c (diff)
downloadmpd-db447440ff8973961e1936a6a64ca4971eeeea57.tar.gz
mpd-db447440ff8973961e1936a6a64ca4971eeeea57.tar.xz
mpd-db447440ff8973961e1936a6a64ca4971eeeea57.zip
event/Event{Pipe,FD}: auto-create in constructor
Errors are fatal now. This makes the class a lot easier to use.
Diffstat (limited to '')
-rw-r--r--src/event/EventFD.hxx17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/event/EventFD.hxx b/src/event/EventFD.hxx
index 803957354..67a0258ab 100644
--- a/src/event/EventFD.hxx
+++ b/src/event/EventFD.hxx
@@ -22,33 +22,22 @@
#include "check.h"
-#include <assert.h>
-
/**
* A class that wraps eventfd().
*
- * For optimization purposes, this class does not have a constructor
- * or a destructor.
+ * Errors in the constructor are fatal.
*/
class EventFD {
int fd;
public:
-#ifdef NDEBUG
- EventFD() = default;
-#else
- EventFD():fd(-1) {}
-#endif
+ EventFD();
+ ~EventFD();
EventFD(const EventFD &other) = delete;
EventFD &operator=(const EventFD &other) = delete;
- bool Create();
- void Destroy();
-
int Get() const {
- assert(fd >= 0);
-
return fd;
}