<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> On 9/6/21 12:47 PM, Guillaume Charifi wrote:</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > Signed-off-by: Guillaume Charifi <guillaume.charifi@sfr.fr></p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > ---</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> >   dlls/ntdll/unix/socket.c |  6 ++---</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> >   include/wine/afd.h       |  2 +-</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> >   server/protocol.def      |  1 +</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> >   server/sock.c            | 52 ++++++++++++++++++++++++++++++++++++++--</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> >   4 files changed, 55 insertions(+), 6 deletions(-)</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> Based on your description [1], it seems to me like it'd be easier just </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> to save the "main" poll request as a poll_req field in the relevant </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> socket. Then your poll_handle_exclusive() can pretty much do exactly </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> what you describe in that mail:</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> if (sock->main_poll && sock->main_poll->exclusive && req->exclusive)</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">>      // terminate it</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> if (!sock->main_poll)</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">>      sock->main_poll = req;</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> Of course the problem is, we can't do this yet, because cancel_async can </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> terminate the async behind our back. I wrote [2] for a different </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> purpose, but if accepted, it'd help here as well.</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><br /></p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">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...</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">This would definitely help.</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><br /></p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> In lieu of [2], though, it'd at least be nice to see a helper function </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> like "get_main_poll", to avoid that goto and boolean variable.</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><br /></p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Agreed.</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><br /></p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> I don't like the name "main_poll", but I'm hard-pressed to come up with </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> something better. "exclusive_poll" perhaps, but it's not guaranteed to </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> actually be exclusive...</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><br /></p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Me neither, what do you think of "pinned_poll"?</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"><br /></p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> [1] https://www.winehq.org/pipermail/wine-devel/2021-September/194463.html</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> [2] https://source.winehq.org/patches/data/213505</p>
</body>
</html>