MCPcopy Create free account
hub / github.com/ceph/ceph / event_wait

Method event_wait

src/msg/async/EventPoll.cc:162–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162int PollDriver::event_wait(std::vector<FiredFileEvent> &fired_events,
163 struct timeval *tvp) {
164 int retval, numevents = 0;
165#ifdef _WIN32
166 retval = WSAPoll(pfds, max_pfds, timeout_to_milliseconds(tvp));
167#else
168 retval = poll(pfds, max_pfds, timeout_to_milliseconds(tvp));
169#endif
170 if (retval > 0) {
171 for (int j = 0; j < max_pfds; j++) {
172 if (pfds[j].fd != -1) {
173 int mask = 0;
174 struct FiredFileEvent fe;
175 if (pfds[j].revents & POLLIN) {
176 mask |= EVENT_READABLE;
177 }
178 if (pfds[j].revents & POLLOUT) {
179 mask |= EVENT_WRITABLE;
180 }
181 if (pfds[j].revents & POLLHUP) {
182 mask |= EVENT_READABLE | EVENT_WRITABLE;
183 }
184 if (pfds[j].revents & POLLERR) {
185 mask |= EVENT_READABLE | EVENT_WRITABLE;
186 }
187 if (mask) {
188 fe.fd = pfds[j].fd;
189 fe.mask = mask;
190 fired_events.push_back(fe);
191 numevents++;
192 }
193 }
194 }
195 }
196 return numevents;
197}

Callers 2

TEST_PFunction · 0.45
process_eventsMethod · 0.45

Calls 2

timeout_to_millisecondsFunction · 0.85
push_backMethod · 0.45

Tested by 1

TEST_PFunction · 0.36