[PATCH 2/3] server: notify the information about pending asyncs.

Dongwan Kim kdw6485 at gmail.com
Sun Dec 5 19:35:50 CST 2021


Problem :
WSARecv call should not intercept message for the waiting overlapped WSARecv.
https://www.winehq.org/pipermail/wine-devel/2021-May/186612.html

A client program needs to know if there are pending asyncs
before calling try_recv.
Wineserver notifies it whenever invoking APC_ASYNC_IO.
Then, the client program will update it.

Signed-off-by: Dongwan Kim <kdw6485 at gmail.com>
---
 include/wine/server_protocol.h | 1 +
 server/async.c                 | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index b37a8e8e056..4dc2eb567db 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -492,6 +492,7 @@ typedef union
         client_ptr_t     user;
         client_ptr_t     sb;
         data_size_t      result;
+        unsigned int     async_wait;
     } async_io;
     struct
     {
diff --git a/server/async.c b/server/async.c
index ec3396c930f..0220bf4e2f4 100644
--- a/server/async.c
+++ b/server/async.c
@@ -164,6 +164,7 @@ static void async_destroy( struct object *obj )
 void async_terminate( struct async *async, unsigned int status )
 {
     struct iosb *iosb = async->iosb;
+    struct async* async_waiting;
 
     if (async->terminated) return;
 
@@ -202,6 +203,13 @@ void async_terminate( struct async *async, unsigned int status )
         else
             data.async_io.status = status;
 
+        async_waiting = find_pending_async(async->queue);
+        if(async_waiting)
+        {
+          data.async_io.async_wait = 1;
+          release_object(async_waiting);
+        }
+
         thread_queue_apc( async->thread->process, async->thread, &async->obj, &data );
     }
 
-- 
2.30.2




More information about the wine-devel mailing list