ntdll: Get rid of the num_async_io counter in the TEB.

This commit is contained in:
Alexandre Julliard 2007-06-04 18:17:16 +02:00
parent 4c5b55a0f8
commit 7c6bc78b90
4 changed files with 9 additions and 31 deletions

View file

@ -645,7 +645,6 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
SERVER_END_REQ;
if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, fileio );
else NtCurrentTeb()->num_async_io++;
goto done;
}
else /* synchronous read, wait for the fd to become ready */
@ -878,7 +877,6 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
SERVER_END_REQ;
if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, fileio );
else NtCurrentTeb()->num_async_io++;
goto done;
}
else /* synchronous write, wait for the fd to become ready */

View file

@ -671,8 +671,6 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
result->async_io.status = call->async_io.func( call->async_io.user,
call->async_io.sb,
call->async_io.status );
if (result->async_io.status != STATUS_PENDING)
NtCurrentTeb()->num_async_io--;
break;
case APC_VIRTUAL_ALLOC:
result->type = call->type;
@ -973,13 +971,10 @@ NTSTATUS WINAPI NtYieldExecution(void)
*/
NTSTATUS WINAPI NtDelayExecution( BOOLEAN alertable, const LARGE_INTEGER *timeout )
{
/* if alertable or async I/O in progress, we need to query the server */
if (alertable || NtCurrentTeb()->num_async_io)
{
UINT flags = SELECT_INTERRUPTIBLE;
if (alertable) flags |= SELECT_ALERTABLE;
return NTDLL_wait_for_multiple_objects( 0, NULL, flags, timeout, 0 );
}
/* if alertable, we need to query the server */
if (alertable)
return NTDLL_wait_for_multiple_objects( 0, NULL, SELECT_INTERRUPTIBLE | SELECT_ALERTABLE,
timeout, 0 );
if (!timeout || timeout->QuadPart == TIMEOUT_INFINITE) /* sleep forever */
{

View file

@ -135,7 +135,6 @@
#include "wsipx.h"
#include "winnt.h"
#include "iphlpapi.h"
#include "thread.h"
#include "wine/server.h"
#include "wine/debug.h"
#include "wine/unicode.h"
@ -1328,11 +1327,6 @@ static int WS2_register_async_shutdown( SOCKET s, int type )
HeapFree( GetProcessHeap(), 0, wsa );
return NtStatusToWSAError( status );
}
else
NtCurrentTeb()->num_async_io++;
/* Try immediate completion */
Sleep(0);
return 0;
}
@ -2681,11 +2675,7 @@ INT WINAPI WSASendTo( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
}
SERVER_END_REQ;
if (err == STATUS_PENDING)
NtCurrentTeb()->num_async_io++;
else
HeapFree( GetProcessHeap(), 0, wsa );
if (err != STATUS_PENDING) HeapFree( GetProcessHeap(), 0, wsa );
WSASetLastError( NtStatusToWSAError( err ));
return SOCKET_ERROR;
}
@ -4206,11 +4196,7 @@ INT WINAPI WSARecvFrom( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
}
SERVER_END_REQ;
if (err == STATUS_PENDING)
NtCurrentTeb()->num_async_io++;
else
HeapFree( GetProcessHeap(), 0, wsa );
if (err != STATUS_PENDING) HeapFree( GetProcessHeap(), 0, wsa );
WSASetLastError( NtStatusToWSAError( err ));
return SOCKET_ERROR;
}

View file

@ -53,11 +53,10 @@ typedef struct _TEB
PVOID SystemReserved2[10]; /* 1d4 */
/* The following are Wine-specific fields (NT: GdiTebBatch) */
DWORD num_async_io; /* 1fc number of pending async I/O in the server */
ULONG_PTR dpmi_vif; /* 200 protected mode virtual interrupt flag */
DWORD vm86_pending; /* 204 data for vm86 mode */
DWORD dpmi_vif; /* 1fc protected mode virtual interrupt flag */
ULONG_PTR vm86_pending; /* 200 data for vm86 mode */
/* here is plenty space for wine specific fields (don't forget to change pad6!!) */
DWORD pad6[309]; /* 208 */
DWORD pad6[310]; /* 204 */
ULONG gdiRgn; /* 6dc */
ULONG gdiPen; /* 6e0 */