ClickHouse/src/Common/TimerDescriptor.h

32 lines
655 B
C++
Raw Normal View History

2020-12-03 12:21:10 +00:00
#pragma once
2020-12-15 18:04:12 +00:00
#if defined(OS_LINUX)
2020-12-03 12:21:10 +00:00
#include <Poco/Timespan.h>
namespace DB
{
2020-12-18 15:12:31 +00:00
/// Wrapper over timerfd.
2020-12-03 12:21:10 +00:00
class TimerDescriptor
{
private:
int timer_fd;
public:
explicit TimerDescriptor(int clockid, int flags);
~TimerDescriptor();
TimerDescriptor(const TimerDescriptor &) = delete;
TimerDescriptor & operator=(const TimerDescriptor &) = delete;
TimerDescriptor(TimerDescriptor &&) = default;
TimerDescriptor & operator=(TimerDescriptor &&) = default;
int getDescriptor() const { return timer_fd; }
void reset() const;
void drain() const;
void setRelative(const Poco::Timespan & timespan) const;
};
}
2020-12-15 18:04:12 +00:00
#endif