ntdll: Remove APC handling from RtlWaitOnAddress.

It uses non-alertable wait anyway.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-04-20 00:02:00 +02:00 committed by Alexandre Julliard
parent fc77666c0b
commit 7a1069e9bd
3 changed files with 13 additions and 27 deletions

View File

@ -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, extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret,
data_size_t *ret_len ) DECLSPEC_HIDDEN; data_size_t *ret_len ) DECLSPEC_HIDDEN;
extern NTSTATUS validate_open_object_attributes( const OBJECT_ATTRIBUTES *attr ) 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 */ /* module handling */
extern LIST_ENTRY tls_links DECLSPEC_HIDDEN; extern LIST_ENTRY tls_links DECLSPEC_HIDDEN;

View File

@ -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. * 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; int signaled;
struct wake_up_reply reply; 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 ) switch( apc->type )
{ {

View File

@ -2557,9 +2557,7 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
{ {
select_op_t select_op; select_op_t select_op;
NTSTATUS ret; NTSTATUS ret;
BOOL user_apc = FALSE;
timeout_t abs_timeout = timeout ? timeout->QuadPart : TIMEOUT_INFINITE; timeout_t abs_timeout = timeout ? timeout->QuadPart : TIMEOUT_INFINITE;
user_apc_t apc;
if (size != 1 && size != 2 && size != 4 && size != 8) if (size != 1 && size != 2 && size != 4 && size != 8)
return STATUS_INVALID_PARAMETER; 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) if ((ret = fast_wait_addr( addr, cmp, size, timeout )) != STATUS_NOT_IMPLEMENTED)
return ret; return ret;
select_op.keyed_event.op = SELECT_KEYED_EVENT_WAIT; RtlEnterCriticalSection( &addr_section );
select_op.keyed_event.handle = wine_server_obj_handle( keyed_event ); if (!compare_addr( addr, cmp, size ))
select_op.keyed_event.key = wine_server_client_ptr( addr ); {
RtlLeaveCriticalSection( &addr_section );
return STATUS_SUCCESS;
}
if (abs_timeout < 0) if (abs_timeout < 0)
{ {
@ -2579,25 +2580,12 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
abs_timeout -= now.QuadPart; abs_timeout -= now.QuadPart;
} }
for (;;) select_op.keyed_event.op = SELECT_KEYED_EVENT_WAIT;
{ select_op.keyed_event.handle = wine_server_obj_handle( keyed_event );
RtlEnterCriticalSection( &addr_section ); select_op.keyed_event.key = wine_server_client_ptr( addr );
if (!compare_addr( addr, cmp, size ))
ret = STATUS_SUCCESS; ret = server_select( &select_op, sizeof(select_op.keyed_event), SELECT_INTERRUPTIBLE, abs_timeout, NULL, NULL );
else
ret = server_select( &select_op, sizeof(select_op.keyed_event), SELECT_INTERRUPTIBLE, abs_timeout, NULL, &apc );
RtlLeaveCriticalSection( &addr_section ); 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;
}
if (ret == STATUS_TIMEOUT && user_apc) ret = STATUS_USER_APC;
return ret; return ret;
} }