MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / wait

Method wait

source/kernel/kepoll.cpp:175–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175U32 KEPoll::wait(KThread* thread, U32 events, U32 maxevents, U32 timeout) {
176 S32 result = 0;
177 U32 pollCount=0;
178 KMemory* memory = thread->memory;
179
180 thread->pollData.clear();
181 for( const auto& n : this->data ) {
182 Data* next = n.value;
183 KPollData pollData;
184
185 pollData.events = next->events;
186 pollData.fd = next->fd;
187 pollData.data = next->data;
188 thread->pollData.push_back(pollData);
189 pollCount++;
190 }
191 result = internal_poll(thread, thread->pollData.data(), pollCount, timeout);
192 if (result >= 0) {
193 result = 0;
194 for (KPollData& data : thread->pollData) {
195 if (data.revents!=0) {
196 memory->writed(events + result * 12, data.revents);
197 memory->writeq(events + result * 12 + 4, data.data);
198 result++;
199 if (result>=(S32)maxevents) {
200 kwarn("possible starvation in epoll, more events are ready than can be received.");
201 break;
202 }
203 }
204 }
205 }
206 return result;
207}

Callers 8

SDL_CondWaitTimeoutFunction · 0.45
sendCommandMethod · 0.45
lockEventsMethod · 0.45
x11_GrabServerFunction · 0.45
x11_LockDisplayFunction · 0.45
stopNativeSocketsThreadFunction · 0.45
epollwaitMethod · 0.45

Calls 7

internal_pollFunction · 0.85
kwarnFunction · 0.85
writeqMethod · 0.80
clearMethod · 0.45
push_backMethod · 0.45
dataMethod · 0.45
writedMethod · 0.45

Tested by

no test coverage detected