ntdll: Introduce wait_async helper.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-05-23 19:35:51 +02:00 committed by Alexandre Julliard
parent 6892d0a559
commit c09a903bfa
1 changed files with 10 additions and 23 deletions

View File

@ -425,6 +425,12 @@ static async_data_t server_async( HANDLE handle, struct async_fileio *user, HAND
return async;
}
static NTSTATUS wait_async( HANDLE handle, BOOL alertable, IO_STATUS_BLOCK *io )
{
NtWaitForSingleObject( handle, alertable, NULL );
return io->u.Status;
}
/* callback for irp async I/O completion */
static NTSTATUS irp_completion( void *user, IO_STATUS_BLOCK *io, NTSTATUS status )
{
@ -588,12 +594,7 @@ static NTSTATUS server_read_file( HANDLE handle, HANDLE event, PIO_APC_ROUTINE a
if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
if (wait_handle)
{
NtWaitForSingleObject( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), NULL );
status = io->u.Status;
}
if (wait_handle) status = wait_async( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), io );
return status;
}
@ -631,12 +632,7 @@ static NTSTATUS server_write_file( HANDLE handle, HANDLE event, PIO_APC_ROUTINE
if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
if (wait_handle)
{
NtWaitForSingleObject( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), NULL );
status = io->u.Status;
}
if (wait_handle) status = wait_async( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), io );
return status;
}
@ -1550,12 +1546,7 @@ static NTSTATUS server_ioctl_file( HANDLE handle, HANDLE event,
if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
if (wait_handle)
{
NtWaitForSingleObject( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), NULL );
status = io->u.Status;
}
if (wait_handle) status = wait_async( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), io );
return status;
}
@ -3350,11 +3341,7 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK *io )
if (ret != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
if (wait_handle)
{
NtWaitForSingleObject( wait_handle, FALSE, NULL );
ret = io->u.Status;
}
if (wait_handle) ret = wait_async( wait_handle, FALSE, io );
}
if (needs_close) close( fd );