Module: wine Branch: master Commit: 7c6bc78b9023afd13d1158725c0f0c98670ab9d9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=7c6bc78b9023afd13d1158725c...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Jun 4 18:17:16 2007 +0200
ntdll: Get rid of the num_async_io counter in the TEB.
---
dlls/ntdll/file.c | 2 -- dlls/ntdll/sync.c | 13 ++++--------- dlls/ws2_32/socket.c | 18 ++---------------- include/thread.h | 7 +++---- 4 files changed, 9 insertions(+), 31 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index b48cc9d..de779f2 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -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 */ diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index ca0605e..134113f 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -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 */ { diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 2b7efdc..542b7ae 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -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; } diff --git a/include/thread.h b/include/thread.h index 68d7ae2..f3dfc0b 100644 --- a/include/thread.h +++ b/include/thread.h @@ -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 */