39 epoll_.
del(notify_.
fd());
46 if (fd >=
static_cast<int>(data_.size())) {
49 auto&
ref = data_[fd];
50 epoll_.
add(fd, ++
ref.sid, events);
53 return {*
this, fd,
ref.sid};
59 using namespace chrono;
83 now = CyclTime::now();
86 throw system_error{
ec};
98 work += tqs_[
Low].dispatch(now);
118 using namespace chrono;
120 const auto& tq = tqs_[
High];
124 next =
min(next, tq.front().expiry() - 200u
s);
128 const auto& tq = tqs_[
Low];
131 next =
min(next, tq.front().expiry());
137int Reactor::dispatch(CyclTime now, Event*
buf,
int size)
140 for (
int i{0};
i <
size; ++
i) {
143 const auto fd = epoll_.
fd(
ev);
144 if (fd == notify_.
fd()) {
148 const auto&
ref = data_[fd];
154 const auto sid = epoll_.
sid(
ev);
169 ref.slot(now, fd, events);
170 }
catch (
const std::exception& e) {
171 TOOLBOX_ERROR <<
"exception in i/o event handler: " << e.what();
178void Reactor::set_events(
int fd,
int sid,
unsigned events,
IoSlot slot, error_code&
ec)
noexcept
180 auto&
ref = data_[fd];
181 if (
ref.sid == sid) {
182 if (
ref.events != events) {
183 epoll_.mod(fd, sid, events,
ec);
193void Reactor::set_events(
int fd,
int sid,
unsigned events,
IoSlot slot)
195 auto&
ref = data_[fd];
196 if (
ref.sid == sid) {
197 if (
ref.events != events) {
198 epoll_.
mod(fd, sid, events);
205void Reactor::set_events(
int fd,
int sid,
unsigned events, error_code&
ec)
noexcept
207 auto&
ref = data_[fd];
208 if (
ref.sid == sid &&
ref.events != events) {
209 epoll_.mod(fd, sid, events,
ec);
217void Reactor::set_events(
int fd,
int sid,
unsigned events)
219 auto&
ref = data_[fd];
220 if (
ref.sid == sid &&
ref.events != events) {
221 epoll_.
mod(fd, sid, events);
226void Reactor::unsubscribe(
int fd,
int sid)
noexcept
228 auto&
ref = data_[fd];
229 if (
ref.sid == sid) {
#define TOOLBOX_PROBE_SCOPED(provider, name,...)