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:
parent
6892d0a559
commit
c09a903bfa
|
@ -425,6 +425,12 @@ static async_data_t server_async( HANDLE handle, struct async_fileio *user, HAND
|
||||||
return async;
|
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 */
|
/* callback for irp async I/O completion */
|
||||||
static NTSTATUS irp_completion( void *user, IO_STATUS_BLOCK *io, NTSTATUS status )
|
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 (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
|
||||||
|
|
||||||
if (wait_handle)
|
if (wait_handle) status = wait_async( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), io );
|
||||||
{
|
|
||||||
NtWaitForSingleObject( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), NULL );
|
|
||||||
status = io->u.Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
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 (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
|
||||||
|
|
||||||
if (wait_handle)
|
if (wait_handle) status = wait_async( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), io );
|
||||||
{
|
|
||||||
NtWaitForSingleObject( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), NULL );
|
|
||||||
status = io->u.Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1550,12 +1546,7 @@ static NTSTATUS server_ioctl_file( HANDLE handle, HANDLE event,
|
||||||
|
|
||||||
if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
|
if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
|
||||||
|
|
||||||
if (wait_handle)
|
if (wait_handle) status = wait_async( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), io );
|
||||||
{
|
|
||||||
NtWaitForSingleObject( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), NULL );
|
|
||||||
status = io->u.Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3350,11 +3341,7 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK *io )
|
||||||
|
|
||||||
if (ret != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
|
if (ret != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
|
||||||
|
|
||||||
if (wait_handle)
|
if (wait_handle) ret = wait_async( wait_handle, FALSE, io );
|
||||||
{
|
|
||||||
NtWaitForSingleObject( wait_handle, FALSE, NULL );
|
|
||||||
ret = io->u.Status;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needs_close) close( fd );
|
if (needs_close) close( fd );
|
||||||
|
|
Loading…
Reference in New Issue