ntdll: Use select request to pass suspend context to server.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e70b684ded
commit
5e7ccd182e
|
@ -115,18 +115,8 @@ void wait_suspend( CONTEXT *context )
|
|||
context_t server_context;
|
||||
DWORD flags = context->ContextFlags;
|
||||
|
||||
context_to_server( &server_context, context );
|
||||
|
||||
/* store the context we got at suspend time */
|
||||
SERVER_START_REQ( set_suspend_context )
|
||||
{
|
||||
wine_server_add_data( req, &server_context, sizeof(server_context) );
|
||||
wine_server_call( req );
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
|
||||
/* wait with 0 timeout, will only return once the thread is no longer suspended */
|
||||
server_select( NULL, 0, SELECT_INTERRUPTIBLE, 0, NULL );
|
||||
server_select( NULL, 0, SELECT_INTERRUPTIBLE, 0, context, NULL );
|
||||
|
||||
/* retrieve the new context */
|
||||
SERVER_START_REQ( get_suspend_context )
|
||||
|
@ -183,7 +173,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, NULL );
|
||||
server_select( &select_op, offsetof( select_op_t, wait.handles[1] ), SELECT_INTERRUPTIBLE, TIMEOUT_INFINITE, NULL, NULL );
|
||||
|
||||
SERVER_START_REQ( get_exception_status )
|
||||
{
|
||||
|
|
|
@ -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, user_apc_t *user_apc ) DECLSPEC_HIDDEN;
|
||||
timeout_t abs_timeout, CONTEXT *context, 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;
|
||||
|
|
|
@ -602,16 +602,23 @@ 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, user_apc_t *user_apc )
|
||||
timeout_t abs_timeout, CONTEXT *context, user_apc_t *user_apc )
|
||||
{
|
||||
unsigned int ret;
|
||||
int cookie;
|
||||
obj_handle_t apc_handle = 0;
|
||||
context_t server_context;
|
||||
BOOL suspend_context = FALSE;
|
||||
apc_call_t call;
|
||||
apc_result_t result;
|
||||
sigset_t old_set;
|
||||
|
||||
memset( &result, 0, sizeof(result) );
|
||||
if (context)
|
||||
{
|
||||
suspend_context = TRUE;
|
||||
context_to_server( &server_context, context );
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -627,6 +634,11 @@ unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT
|
|||
req->size = size;
|
||||
wine_server_add_data( req, &result, sizeof(result) );
|
||||
wine_server_add_data( req, select_op, size );
|
||||
if (suspend_context)
|
||||
{
|
||||
wine_server_add_data( req, &server_context, sizeof(server_context) );
|
||||
suspend_context = FALSE; /* server owns the context now */
|
||||
}
|
||||
ret = server_call_unlocked( req );
|
||||
apc_handle = reply->apc_handle;
|
||||
call = reply->call;
|
||||
|
@ -673,7 +685,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, &apc );
|
||||
ret = server_select( select_op, size, flags, abs_timeout, NULL, &apc );
|
||||
if (ret != STATUS_USER_APC) break;
|
||||
invoke_apc( &apc );
|
||||
|
||||
|
|
|
@ -2585,7 +2585,7 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
|
|||
if (!compare_addr( addr, cmp, size ))
|
||||
ret = STATUS_SUCCESS;
|
||||
else
|
||||
ret = server_select( &select_op, sizeof(select_op.keyed_event), SELECT_INTERRUPTIBLE, abs_timeout, &apc );
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue