Jacek Caban : ntdll: Remove APC handling from RtlWaitOnAddress.
Alexandre Julliard
julliard at winehq.org
Mon Apr 20 15:48:19 CDT 2020
Module: wine
Branch: master
Commit: 7a1069e9bd3ba4a7abbc78b9f012bc05e9b818e8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=7a1069e9bd3ba4a7abbc78b9f012bc05e9b818e8
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Apr 20 00:02:00 2020 +0200
ntdll: Remove APC handling from RtlWaitOnAddress.
It uses non-alertable wait anyway.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/ntdll_misc.h | 2 --
dlls/ntdll/server.c | 4 ++--
dlls/ntdll/sync.c | 34 +++++++++++-----------------------
3 files changed, 13 insertions(+), 27 deletions(-)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 336d7c0463..964953e27d 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -128,8 +128,6 @@ extern int server_pipe( int fd[2] ) DECLSPEC_HIDDEN;
extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret,
data_size_t *ret_len ) DECLSPEC_HIDDEN;
extern NTSTATUS validate_open_object_attributes( const OBJECT_ATTRIBUTES *attr ) DECLSPEC_HIDDEN;
-extern int wait_select_reply( void *cookie ) DECLSPEC_HIDDEN;
-extern void invoke_apc( const user_apc_t *apc ) DECLSPEC_HIDDEN;
/* module handling */
extern LIST_ENTRY tls_links DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index be080a9f73..3de5a93556 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -349,7 +349,7 @@ void server_leave_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sig
*
* Wait for a reply on the waiting pipe of the current thread.
*/
-int wait_select_reply( void *cookie )
+static int wait_select_reply( void *cookie )
{
int signaled;
struct wake_up_reply reply;
@@ -381,7 +381,7 @@ int wait_select_reply( void *cookie )
}
-void invoke_apc( const user_apc_t *apc )
+static void invoke_apc( const user_apc_t *apc )
{
switch( apc->type )
{
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index be00ac75d0..d3927a05af 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -2557,9 +2557,7 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
{
select_op_t select_op;
NTSTATUS ret;
- BOOL user_apc = FALSE;
timeout_t abs_timeout = timeout ? timeout->QuadPart : TIMEOUT_INFINITE;
- user_apc_t apc;
if (size != 1 && size != 2 && size != 4 && size != 8)
return STATUS_INVALID_PARAMETER;
@@ -2567,9 +2565,12 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
if ((ret = fast_wait_addr( addr, cmp, size, timeout )) != STATUS_NOT_IMPLEMENTED)
return ret;
- select_op.keyed_event.op = SELECT_KEYED_EVENT_WAIT;
- select_op.keyed_event.handle = wine_server_obj_handle( keyed_event );
- select_op.keyed_event.key = wine_server_client_ptr( addr );
+ RtlEnterCriticalSection( &addr_section );
+ if (!compare_addr( addr, cmp, size ))
+ {
+ RtlLeaveCriticalSection( &addr_section );
+ return STATUS_SUCCESS;
+ }
if (abs_timeout < 0)
{
@@ -2579,25 +2580,12 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
abs_timeout -= now.QuadPart;
}
- for (;;)
- {
- RtlEnterCriticalSection( &addr_section );
- if (!compare_addr( addr, cmp, size ))
- ret = STATUS_SUCCESS;
- else
- ret = server_select( &select_op, sizeof(select_op.keyed_event), SELECT_INTERRUPTIBLE, abs_timeout, NULL, &apc );
- RtlLeaveCriticalSection( &addr_section );
-
- if (ret != STATUS_USER_APC) break;
- invoke_apc( &apc );
-
- /* if we ran a user apc we have to check once more if additional apcs are queued,
- * but we don't want to wait */
- abs_timeout = 0;
- user_apc = TRUE;
- }
+ select_op.keyed_event.op = SELECT_KEYED_EVENT_WAIT;
+ select_op.keyed_event.handle = wine_server_obj_handle( keyed_event );
+ select_op.keyed_event.key = wine_server_client_ptr( addr );
- if (ret == STATUS_TIMEOUT && user_apc) ret = STATUS_USER_APC;
+ ret = server_select( &select_op, sizeof(select_op.keyed_event), SELECT_INTERRUPTIBLE, abs_timeout, NULL, NULL );
+ RtlLeaveCriticalSection( &addr_section );
return ret;
}
More information about the wine-cvs
mailing list