ntdll: Leave critical section before blocking in RtlWaitOnAddress.

Fixes regression from commit 4f673d5386.

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:29 +02:00 committed by Alexandre Julliard
parent 7a1069e9bd
commit eaad238000
4 changed files with 11 additions and 8 deletions

View File

@ -114,7 +114,7 @@ void wait_suspend( CONTEXT *context )
int saved_errno = errno;
/* wait with 0 timeout, will only return once the thread is no longer suspended */
server_select( NULL, 0, SELECT_INTERRUPTIBLE, 0, context, NULL );
server_select( NULL, 0, SELECT_INTERRUPTIBLE, 0, context, NULL, NULL );
errno = saved_errno;
}
@ -159,7 +159,7 @@ NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *con
{
select_op.wait.op = SELECT_WAIT;
select_op.wait.handles[0] = handle;
server_select( &select_op, offsetof( select_op_t, wait.handles[1] ), SELECT_INTERRUPTIBLE, TIMEOUT_INFINITE, &exception_context, NULL );
server_select( &select_op, offsetof( select_op_t, wait.handles[1] ), SELECT_INTERRUPTIBLE, TIMEOUT_INFINITE, &exception_context, NULL, NULL );
SERVER_START_REQ( get_exception_status )
{

View File

@ -117,7 +117,7 @@ extern unsigned int server_call_unlocked( void *req_ptr ) DECLSPEC_HIDDEN;
extern void server_enter_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset ) DECLSPEC_HIDDEN;
extern void server_leave_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset ) DECLSPEC_HIDDEN;
extern unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT flags,
timeout_t abs_timeout, CONTEXT *context, user_apc_t *user_apc ) DECLSPEC_HIDDEN;
timeout_t abs_timeout, CONTEXT *context, RTL_CRITICAL_SECTION *cs, user_apc_t *user_apc ) DECLSPEC_HIDDEN;
extern unsigned int server_wait( const select_op_t *select_op, data_size_t size,
UINT flags, const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN;
extern unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *call, apc_result_t *result ) DECLSPEC_HIDDEN;

View File

@ -602,7 +602,7 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result )
* server_select
*/
unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT flags,
timeout_t abs_timeout, CONTEXT *context, user_apc_t *user_apc )
timeout_t abs_timeout, CONTEXT *context, RTL_CRITICAL_SECTION *cs, user_apc_t *user_apc )
{
unsigned int ret;
int cookie;
@ -660,6 +660,11 @@ unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT
size = offsetof( select_op_t, signal_and_wait.signal );
}
pthread_sigmask( SIG_SETMASK, &old_set, NULL );
if (cs)
{
RtlLeaveCriticalSection( cs );
cs = NULL;
}
if (ret != STATUS_PENDING) break;
ret = wait_select_reply( &cookie );
@ -692,7 +697,7 @@ unsigned int server_wait( const select_op_t *select_op, data_size_t size, UINT f
for (;;)
{
ret = server_select( select_op, size, flags, abs_timeout, NULL, &apc );
ret = server_select( select_op, size, flags, abs_timeout, NULL, NULL, &apc );
if (ret != STATUS_USER_APC) break;
invoke_apc( &apc );

View File

@ -2584,9 +2584,7 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
select_op.keyed_event.handle = wine_server_obj_handle( keyed_event );
select_op.keyed_event.key = wine_server_client_ptr( addr );
ret = server_select( &select_op, sizeof(select_op.keyed_event), SELECT_INTERRUPTIBLE, abs_timeout, NULL, NULL );
RtlLeaveCriticalSection( &addr_section );
return ret;
return server_select( &select_op, sizeof(select_op.keyed_event), SELECT_INTERRUPTIBLE, abs_timeout, NULL, &addr_section, NULL );
}
/***********************************************************************