Jacek Caban : server: Reselect read queue before write queue in pipe_end_write.
Alexandre Julliard
julliard at winehq.org
Wed Oct 16 16:59:29 CDT 2019
Module: wine
Branch: master
Commit: add05569917152b45f3288f67f7e7a0ae62d0fbb
URL: https://source.winehq.org/git/wine.git/?a=commit;h=add05569917152b45f3288f67f7e7a0ae62d0fbb
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Oct 16 14:50:18 2019 +0200
server: Reselect read queue before write queue in pipe_end_write.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
server/named_pipe.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 6926712b8c..1e0c5898a1 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -787,11 +787,10 @@ static int ignore_reselect;
static void reselect_write_queue( struct pipe_end *pipe_end );
-static void reselect_read_queue( struct pipe_end *pipe_end )
+static void reselect_read_queue( struct pipe_end *pipe_end, int reselect_write )
{
struct async *async;
struct iosb *iosb;
- int read_done = 0;
ignore_reselect = 1;
while (!list_empty( &pipe_end->message_queue ) && (async = find_pending_async( &pipe_end->read_q )))
@@ -801,7 +800,7 @@ static void reselect_read_queue( struct pipe_end *pipe_end )
async_terminate( async, iosb->result ? STATUS_ALERTED : iosb->status );
release_object( async );
release_object( iosb );
- read_done = 1;
+ reselect_write = 1;
}
ignore_reselect = 0;
@@ -809,7 +808,7 @@ static void reselect_read_queue( struct pipe_end *pipe_end )
{
if (list_empty( &pipe_end->message_queue ))
fd_async_wake_up( pipe_end->connection->fd, ASYNC_TYPE_WAIT, STATUS_SUCCESS );
- else if (read_done)
+ else if (reselect_write)
reselect_write_queue( pipe_end->connection );
}
}
@@ -841,7 +840,7 @@ static void reselect_write_queue( struct pipe_end *pipe_end )
}
ignore_reselect = 0;
- reselect_read_queue( reader );
+ reselect_read_queue( reader, 0 );
}
static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos )
@@ -870,7 +869,7 @@ static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos )
}
queue_async( &pipe_end->read_q, async );
- reselect_read_queue( pipe_end );
+ reselect_read_queue( pipe_end, 0 );
set_error( STATUS_PENDING );
return 1;
}
@@ -905,7 +904,7 @@ static int pipe_end_write( struct fd *fd, struct async *async, file_pos_t pos )
message->async = (struct async *)grab_object( async );
queue_async( &pipe_end->write_q, async );
- reselect_write_queue( pipe_end );
+ reselect_read_queue( pipe_end->connection, 1 );
set_error( STATUS_PENDING );
return 1;
}
@@ -919,7 +918,7 @@ static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue )
if (&pipe_end->write_q == queue)
reselect_write_queue( pipe_end );
else if (&pipe_end->read_q == queue)
- reselect_read_queue( pipe_end );
+ reselect_read_queue( pipe_end, 0 );
}
static enum server_fd_type pipe_end_get_fd_type( struct fd *fd )
@@ -1019,10 +1018,10 @@ static int pipe_end_transceive( struct pipe_end *pipe_end, struct async *async )
message = queue_message( pipe_end->connection, iosb );
release_object( iosb );
if (!message) return 0;
- reselect_read_queue( pipe_end->connection );
+ reselect_read_queue( pipe_end->connection, 0 );
queue_async( &pipe_end->read_q, async );
- reselect_read_queue( pipe_end );
+ reselect_read_queue( pipe_end, 0 );
set_error( STATUS_PENDING );
return 1;
}
More information about the wine-cvs
mailing list