prevent infinite loop in cleanup code for

io_close-with-outstanding-events-queued race prevention
master
leitner 4 years ago
parent 5f9f1a2a62
commit 15f004df55

@ -123,12 +123,11 @@ int64 io_waituntil2(int64 milliseconds) {
if (first_deferred!=-1) { if (first_deferred!=-1) {
while (first_deferred!=-1) { while (first_deferred!=-1) {
io_entry* e=iarray_get(&io_fds,first_deferred); io_entry* e=iarray_get(&io_fds,first_deferred);
if (e) { if (e && e->closed) {
if (e->closed) {
e->closed=0; e->closed=0;
close(first_deferred); close(first_deferred);
}
first_deferred=e->next_defer; first_deferred=e->next_defer;
e->next_defer=-1;
} else } else
first_deferred=-1; // can't happen first_deferred=-1; // can't happen
} }

Loading…
Cancel
Save