34 lines
800 B
C++
34 lines
800 B
C++
|
/***
|
||
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||
|
|
||
|
File: LSSignalCatcher.Linux.hpp
|
||
|
Date: 2022-8-27
|
||
|
Author: Reece
|
||
|
***/
|
||
|
#pragma once
|
||
|
#include "LSHandle.hpp"
|
||
|
|
||
|
#include <sys/signalfd.h>
|
||
|
|
||
|
namespace Aurora::IO::Loop
|
||
|
{
|
||
|
struct LSSignalCatcher : ILSSignalCatcher, virtual LSHandle
|
||
|
{
|
||
|
LSSignalCatcher(const AuList<int> &signals);
|
||
|
~LSSignalCatcher();
|
||
|
|
||
|
virtual void *GetLastSignalInfo() override;
|
||
|
|
||
|
virtual bool OnTrigger(AuUInt handle) override;
|
||
|
|
||
|
bool IsSignaled() override;
|
||
|
bool WaitOn(AuUInt32 timeout) override;
|
||
|
virtual ELoopSource GetType() override;
|
||
|
|
||
|
private:
|
||
|
void Init(const AuList<int> &signals);
|
||
|
|
||
|
bool IsSignaledNonblocking();
|
||
|
signalfd_siginfo siginfo_;
|
||
|
};
|
||
|
}
|