Commit 5c8d1127 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

server: Introduce async_is_blocking helper and use it in sock_ioctl.

parent 5af62255
...@@ -472,6 +472,11 @@ struct iosb *async_get_iosb( struct async *async ) ...@@ -472,6 +472,11 @@ struct iosb *async_get_iosb( struct async *async )
return async->iosb ? (struct iosb *)grab_object( async->iosb ) : NULL; 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 */ /* find the first pending async in queue */
struct async *find_pending_async( struct async_queue *queue ) struct async *find_pending_async( struct async_queue *queue )
{ {
......
...@@ -187,6 +187,7 @@ extern struct completion *fd_get_completion( struct fd *fd, apc_param_t *p_key ) ...@@ -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 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 *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 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 struct async *find_pending_async( struct async_queue *queue );
extern void cancel_process_asyncs( struct process *process ); extern void cancel_process_asyncs( struct process *process );
......
...@@ -545,14 +545,14 @@ obj_handle_t sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async, ...@@ -545,14 +545,14 @@ obj_handle_t sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async,
switch(code) switch(code)
{ {
case WS_SIO_ADDRESS_LIST_CHANGE: 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 ); set_error( STATUS_CANT_WAIT );
return 0; return 0;
} }
if (!(ifchange_q = sock_get_ifchange_q( sock ))) return 0; if (!(ifchange_q = sock_get_ifchange_q( sock ))) return 0;
queue_async( ifchange_q, async ); 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 ); set_error( STATUS_PENDING );
return wait_handle; return wait_handle;
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment