File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,18 @@ let update t waiters fd =
118
118
in
119
119
if flags = Poll.Flags. empty then (
120
120
Poll. invalidate_index t.poll fdi;
121
+ (* Try to find the new maxi, go back on index until we find the next
122
+ used slot, -1 means none in use. *)
123
+ let rec lower_maxi = function
124
+ | - 1 -> t.poll_maxi < - - 1
125
+ | index ->
126
+ if Poll. ((get_fd t.poll index) <> invalid_fd) then
127
+ t.poll_maxi < - index
128
+ else
129
+ lower_maxi (pred index)
130
+ in
131
+ if fdi = t.poll_maxi then
132
+ lower_maxi (pred fdi);
121
133
Hashtbl. remove t.fd_map fd
122
134
) else (
123
135
Poll. set_index t.poll fdi fd flags;
@@ -223,7 +235,7 @@ let with_sched fn =
223
235
in
224
236
let poll = Poll. create () in
225
237
let fd_map = Hashtbl. create 10 in
226
- let t = { run_q; poll; poll_maxi = 0 ; fd_map; eventfd; eventfd_r;
238
+ let t = { run_q; poll; poll_maxi = ( - 1 ) ; fd_map; eventfd; eventfd_r;
227
239
active_ops = 0 ; need_wakeup = Atomic. make false ; sleep_q } in
228
240
let eventfd_ri = Iomux.Util. fd_of_unix eventfd_r in
229
241
Poll. set_index t.poll eventfd_ri eventfd_r Poll.Flags. pollin;
You can’t perform that action at this time.
0 commit comments