<div dir="ltr"><div dir="ltr"><div dir="ltr">Digging through the different backends, it looks like only the kqueue backend is even capable of returning False when modifyFd/modifyFdOnce is called. This happens when kevent returns eINTR or eINVAL. Why do we call the callback here instead of just throwing an error like we do in so many other cases?</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 6, 2019 at 5:44 PM Andrew Martin <<a href="mailto:andrew.thaddeus@gmail.com">andrew.thaddeus@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">In the event manager's registerFd_, we find:<div><br></div><div><div> registerFd_ :: EventManager -> IOCallback -> Fd -> Event -> Lifetime</div><div> -> IO (FdKey, Bool)</div><div> registerFd_ mgr@(EventManager{..}) cb !fd !evs lt = do</div><div> ... <- ...</div><div><div> (modify,ok) <- withMVar (callbackTableVar mgr fd) $ \tbl -> do</div></div><div> ... <- ...</div><div><div> -- this simulates behavior of old IO manager:</div><div> -- i.e. just call the callback if the registration fails.</div><div> when (not ok) (cb reg evs)</div><div> return (reg,modify)</div></div><div><br></div><div>A comment and a question. Comment: registerFd_ is only ever called in contexts where exceptions are masked, so withMVar is doing some needless mask/restore. Question: why do we immidiately call the callback if event registration fails? This means that if event registration fails during something like `threadWaitRead`, the end result would be that `threadWaitRead` would just return immidiately. That doesn't seem good.</div><div><br></div>-- <br><div dir="ltr" class="gmail-m_2515906648899415829gmail_signature">-Andrew Thaddeus Martin</div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">-Andrew Thaddeus Martin</div>