server: Introduce create_server_async and use it in read request handler.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-06-13 16:46:41 +02:00 committed by Alexandre Julliard
parent 5e486f6de0
commit 26c5336494
3 changed files with 19 additions and 10 deletions

View File

@ -272,6 +272,20 @@ struct async *create_async( struct thread *thread, const async_data_t *data, str
return async;
}
/* create an async associated with iosb for async-based requests */
struct async *create_request_async( struct thread *thread, const async_data_t *data )
{
struct async *async;
struct iosb *iosb;
if (!(iosb = create_iosb( get_req_data(), get_req_data_size(), get_reply_max_size() )))
return NULL;
async = create_async( current, data, iosb );
release_object( iosb );
return async;
}
/* set the timeout of an async operation */
void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status )
{

View File

@ -2446,20 +2446,14 @@ DECL_HANDLER(read)
{
struct fd *fd = get_handle_fd_obj( current->process, req->async.handle, FILE_READ_DATA );
struct async *async;
struct iosb *iosb;
if (!fd) return;
if ((iosb = create_iosb( NULL, 0, get_reply_max_size() )))
if ((async = create_request_async( current, &req->async )))
{
async = create_async( current, &req->async, iosb );
if (async)
{
reply->wait = fd->fd_ops->read( fd, async, req->pos );
reply->options = fd->options;
release_object( async );
}
release_object( iosb );
reply->wait = fd->fd_ops->read( fd, async, req->pos );
reply->options = fd->options;
release_object( async );
}
release_object( fd );
}

View File

@ -176,6 +176,7 @@ extern struct object *create_serial( struct fd *fd );
extern struct async_queue *create_async_queue( struct fd *fd );
extern void free_async_queue( struct async_queue *queue );
extern struct async *create_async( struct thread *thread, const async_data_t *data, struct iosb *iosb );
extern struct async *create_request_async( struct thread *thread, const async_data_t *data );
extern void queue_async( struct async_queue *queue, struct async *async );
extern void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status );
extern void async_set_result( struct object *obj, unsigned int status, apc_param_t total );