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:
parent
5e486f6de0
commit
26c5336494
|
@ -272,6 +272,20 @@ struct async *create_async( struct thread *thread, const async_data_t *data, str
|
||||||
return async;
|
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 */
|
/* set the timeout of an async operation */
|
||||||
void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status )
|
void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status )
|
||||||
{
|
{
|
||||||
|
|
14
server/fd.c
14
server/fd.c
|
@ -2446,20 +2446,14 @@ DECL_HANDLER(read)
|
||||||
{
|
{
|
||||||
struct fd *fd = get_handle_fd_obj( current->process, req->async.handle, FILE_READ_DATA );
|
struct fd *fd = get_handle_fd_obj( current->process, req->async.handle, FILE_READ_DATA );
|
||||||
struct async *async;
|
struct async *async;
|
||||||
struct iosb *iosb;
|
|
||||||
|
|
||||||
if (!fd) return;
|
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 );
|
reply->wait = fd->fd_ops->read( fd, async, req->pos );
|
||||||
if (async)
|
reply->options = fd->options;
|
||||||
{
|
release_object( async );
|
||||||
reply->wait = fd->fd_ops->read( fd, async, req->pos );
|
|
||||||
reply->options = fd->options;
|
|
||||||
release_object( async );
|
|
||||||
}
|
|
||||||
release_object( iosb );
|
|
||||||
}
|
}
|
||||||
release_object( fd );
|
release_object( fd );
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,6 +176,7 @@ extern struct object *create_serial( struct fd *fd );
|
||||||
extern struct async_queue *create_async_queue( struct fd *fd );
|
extern struct async_queue *create_async_queue( struct fd *fd );
|
||||||
extern void free_async_queue( struct async_queue *queue );
|
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_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 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_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 );
|
extern void async_set_result( struct object *obj, unsigned int status, apc_param_t total );
|
||||||
|
|
Loading…
Reference in New Issue