ClickHouse/src/Common/TimerDescriptor.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
663 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:
2024-07-27 18:50:21 +00:00
TimerDescriptor();
2020-12-03 12:21:10 +00:00
~TimerDescriptor();
TimerDescriptor(const TimerDescriptor &) = delete;
TimerDescriptor & operator=(const TimerDescriptor &) = delete;
TimerDescriptor(TimerDescriptor && other) noexcept;
TimerDescriptor & operator=(TimerDescriptor &&) noexcept;
2020-12-03 12:21:10 +00:00
int getDescriptor() const { return timer_fd; }
void reset() const;
void drain() const;
void setRelative(uint64_t usec) const;
2021-04-29 16:11:20 +00:00
void setRelative(Poco::Timespan timespan) const;
2020-12-03 12:21:10 +00:00
};
}
2020-12-15 18:04:12 +00:00
#endif