Module: wine Branch: master Commit: 5c8d11270d18eaa3bb11dc7cae3f0006df0d7171 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5c8d11270d18eaa3bb11dc7cae...
Author: Jacek Caban jacek@codeweavers.com Date: Wed Apr 12 13:53:41 2017 +0200
server: Introduce async_is_blocking helper and use it in sock_ioctl.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
server/async.c | 5 +++++ server/file.h | 1 + server/sock.c | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/server/async.c b/server/async.c index 7323047..f9d8af3 100644 --- a/server/async.c +++ b/server/async.c @@ -472,6 +472,11 @@ struct iosb *async_get_iosb( struct async *async ) return async->iosb ? (struct iosb *)grab_object( async->iosb ) : NULL; }
+int async_is_blocking( struct async *async ) +{ + return !async->event && !async->data.apc && !async->data.apc_context; +} + /* find the first pending async in queue */ struct async *find_pending_async( struct async_queue *queue ) { diff --git a/server/file.h b/server/file.h index 94cc37f..5bb935c 100644 --- a/server/file.h +++ b/server/file.h @@ -187,6 +187,7 @@ extern struct completion *fd_get_completion( struct fd *fd, apc_param_t *p_key ) extern void fd_copy_completion( struct fd *src, struct fd *dst ); extern struct iosb *create_iosb( const void *in_data, data_size_t in_size, data_size_t out_size ); extern struct iosb *async_get_iosb( struct async *async ); +extern int async_is_blocking( struct async *async ); extern struct async *find_pending_async( struct async_queue *queue ); extern void cancel_process_asyncs( struct process *process );
diff --git a/server/sock.c b/server/sock.c index 59ab427..fde38c8 100644 --- a/server/sock.c +++ b/server/sock.c @@ -545,14 +545,14 @@ obj_handle_t sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async, switch(code) { case WS_SIO_ADDRESS_LIST_CHANGE: - if ((sock->state & FD_WINE_NONBLOCKING) && blocking) + if ((sock->state & FD_WINE_NONBLOCKING) && async_is_blocking( async )) { set_error( STATUS_CANT_WAIT ); return 0; } if (!(ifchange_q = sock_get_ifchange_q( sock ))) return 0; queue_async( ifchange_q, async ); - if (blocking) wait_handle = alloc_handle( current->process, async, SYNCHRONIZE, 0 ); + if (async_is_blocking( async )) wait_handle = alloc_handle( current->process, async, SYNCHRONIZE, 0 ); set_error( STATUS_PENDING ); return wait_handle; default: