Jacek Caban : server: Moved server-independent parts of pipe_server_flush into separated function.
Alexandre Julliard
julliard at winehq.org
Wed Feb 22 15:42:04 CST 2017
Module: wine
Branch: master
Commit: e50d49c17a3c9d51621a5781dda1a107bee0b949
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e50d49c17a3c9d51621a5781dda1a107bee0b949
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Feb 22 14:51:17 2017 +0100
server: Moved server-independent parts of pipe_server_flush into separated function.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
server/named_pipe.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 4a4769b..6861e0f 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -548,23 +548,31 @@ static void check_flushed( void *arg )
}
}
+static obj_handle_t pipe_end_flush( struct pipe_end *pipe_end, struct async *async, int blocking )
+{
+ obj_handle_t handle = 0;
+
+ if (!fd_queue_async( pipe_end->fd, async, ASYNC_TYPE_WAIT )) return 0;
+
+ if (!blocking || (handle = alloc_handle( current->process, async, SYNCHRONIZE, 0 )))
+ set_error( STATUS_PENDING );
+ return handle;
+}
+
static obj_handle_t pipe_server_flush( struct fd *fd, struct async *async, int blocking )
{
struct pipe_server *server = get_fd_user( fd );
- obj_handle_t handle = 0;
+ obj_handle_t handle;
if (!server || server->state != ps_connected_server) return 0;
if (!pipe_data_remaining( server )) return 0;
- if (fd_queue_async( server->pipe_end.fd, async, ASYNC_TYPE_WAIT ))
- {
- /* there's no unix way to be alerted when a pipe becomes empty, so resort to polling */
- if (!server->flush_poll)
- server->flush_poll = add_timeout_user( -TICKS_PER_SEC / 10, check_flushed, server );
- if (blocking) handle = alloc_handle( current->process, async, SYNCHRONIZE, 0 );
- set_error( STATUS_PENDING );
- }
+ handle = pipe_end_flush( &server->pipe_end, async, blocking );
+
+ /* there's no unix way to be alerted when a pipe becomes empty, so resort to polling */
+ if (handle && !server->flush_poll)
+ server->flush_poll = add_timeout_user( -TICKS_PER_SEC / 10, check_flushed, server );
return handle;
}
More information about the wine-cvs
mailing list