> On 9/6/21 12:47 PM, Guillaume Charifi wrote:

> > Signed-off-by: Guillaume Charifi <guillaume.charifi@sfr.fr>

> > ---

> >   dlls/ntdll/unix/socket.c |  6 ++---

> >   include/wine/afd.h       |  2 +-

> >   server/protocol.def      |  1 +

> >   server/sock.c            | 52 ++++++++++++++++++++++++++++++++++++++--

> >   4 files changed, 55 insertions(+), 6 deletions(-)

> >

>

> Based on your description [1], it seems to me like it'd be easier just

> to save the "main" poll request as a poll_req field in the relevant

> socket. Then your poll_handle_exclusive() can pretty much do exactly

> what you describe in that mail:

>

> if (sock->main_poll && sock->main_poll->exclusive && req->exclusive)

>      // terminate it

> if (!sock->main_poll)

>      sock->main_poll = req;

>

> Of course the problem is, we can't do this yet, because cancel_async can

> terminate the async behind our back. I wrote [2] for a different

> purpose, but if accepted, it'd help here as well.


Yeah, I didn't do it because I wasn't sure the referenced handles would still be valid at the time the function would get called...

This would definitely help.


>

> In lieu of [2], though, it'd at least be nice to see a helper function

> like "get_main_poll", to avoid that goto and boolean variable.


Agreed.


>

> I don't like the name "main_poll", but I'm hard-pressed to come up with

> something better. "exclusive_poll" perhaps, but it's not guaranteed to

> actually be exclusive...


Me neither, what do you think of "pinned_poll"?


>

> [1] https://www.winehq.org/pipermail/wine-devel/2021-September/194463.html

>

> [2] https://source.winehq.org/patches/data/213505