Commit cd4b673b authored by Max Kellermann's avatar Max Kellermann

event/WakeFD: convert macro to class with a GetSocket() method

parent 0d606c74
......@@ -57,7 +57,7 @@ EventLoop::EventLoop(
#endif
{
#ifdef HAVE_THREADED_EVENT_LOOP
wake_event.Open(SocketDescriptor(wake_fd.Get()));
wake_event.Open(wake_fd.GetSocket());
#endif
}
......
......@@ -20,14 +20,34 @@
#ifndef MPD_WAKE_FD_HXX
#define MPD_WAKE_FD_HXX
#include "net/SocketDescriptor.hxx"
#include "event/Features.h"
#ifdef USE_EVENTFD
#include "system/EventFD.hxx"
#define WakeFD EventFD
#else
#include "system/EventPipe.hxx"
#define WakeFD EventPipe
#endif
class WakeFD {
#ifdef USE_EVENTFD
EventFD fd;
#else
EventPipe fd;
#endif
public:
SocketDescriptor GetSocket() const noexcept {
return SocketDescriptor(fd.Get());
}
bool Read() noexcept {
return fd.Read();
}
void Write() noexcept {
fd.Write();
}
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment