system/SignalFD: use class UniqueFileDescriptor

This commit is contained in:
Max Kellermann 2017-08-10 12:11:52 +02:00
parent 292d794806
commit 8333551331
2 changed files with 5 additions and 18 deletions

View File

@ -32,13 +32,6 @@ SignalFD::Create(const sigset_t &mask)
FatalSystemError("signalfd() failed");
}
void
SignalFD::Close()
{
if (fd.IsDefined())
fd.Close();
}
int
SignalFD::Read()
{

View File

@ -21,7 +21,7 @@
#define MPD_SIGNAL_FD_HXX
#include "check.h"
#include "FileDescriptor.hxx"
#include "UniqueFileDescriptor.hxx"
#include <signal.h>
@ -29,24 +29,18 @@
* A class that wraps signalfd().
*/
class SignalFD {
FileDescriptor fd;
UniqueFileDescriptor fd;
public:
SignalFD():fd(-1) {}
~SignalFD() {
Close();
}
SignalFD(const SignalFD &other) = delete;
SignalFD &operator=(const SignalFD &other) = delete;
/**
* Create the signalfd or update its mask.
*
* All errors are fatal.
*/
void Create(const sigset_t &mask);
void Close();
void Close() {
fd.Close();
}
int Get() const {
return fd.Get();