server: Check for the need to suspend a thread again once it leaves an exception or suspend block.
This commit is contained in:
parent
e1eb6228f4
commit
5dc9c73c31
|
@ -308,7 +308,11 @@ static void debug_event_destroy( struct object *obj )
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (event->sender->context == &event->context) event->sender->context = NULL;
|
||||
if (event->sender->context == &event->context)
|
||||
{
|
||||
event->sender->context = NULL;
|
||||
stop_thread_if_suspended( event->sender );
|
||||
}
|
||||
release_object( event->sender );
|
||||
release_object( event->debugger );
|
||||
}
|
||||
|
@ -680,6 +684,7 @@ DECL_HANDLER(get_exception_status)
|
|||
data_size_t size = min( sizeof(context_t), get_reply_max_size() );
|
||||
set_reply_data( &event->context, size );
|
||||
current->context = NULL;
|
||||
stop_thread_if_suspended( current );
|
||||
}
|
||||
set_error( event->status );
|
||||
}
|
||||
|
|
|
@ -1045,7 +1045,7 @@ DECL_HANDLER(init_process_done)
|
|||
set_process_startup_state( process, STARTUP_DONE );
|
||||
|
||||
if (req->gui) process->idle_event = create_event( NULL, NULL, 0, 1, 0, NULL );
|
||||
if (current->suspend + process->suspend > 0) stop_thread( current );
|
||||
stop_thread_if_suspended( current );
|
||||
if (process->debugger) set_process_debug_flag( process, 1 );
|
||||
}
|
||||
|
||||
|
|
|
@ -491,6 +491,12 @@ void stop_thread( struct thread *thread )
|
|||
if (is_process_init_done(thread->process)) send_thread_signal( thread, SIGUSR1 );
|
||||
}
|
||||
|
||||
/* stop a thread if it's supposed to be suspended */
|
||||
void stop_thread_if_suspended( struct thread *thread )
|
||||
{
|
||||
if (thread->suspend + thread->process->suspend > 0) stop_thread( thread );
|
||||
}
|
||||
|
||||
/* suspend a thread */
|
||||
static int suspend_thread( struct thread *thread )
|
||||
{
|
||||
|
@ -1182,7 +1188,7 @@ DECL_HANDLER(init_thread)
|
|||
}
|
||||
if (process->unix_pid != current->unix_pid)
|
||||
process->unix_pid = -1; /* can happen with linuxthreads */
|
||||
if (current->suspend + process->suspend > 0) stop_thread( current );
|
||||
stop_thread_if_suspended( current );
|
||||
generate_debug_event( current, CREATE_THREAD_DEBUG_EVENT, &req->entry );
|
||||
set_thread_affinity( current, current->affinity );
|
||||
}
|
||||
|
@ -1556,7 +1562,11 @@ DECL_HANDLER(get_suspend_context)
|
|||
if (current->suspend_context)
|
||||
{
|
||||
set_reply_data_ptr( current->suspend_context, sizeof(context_t) );
|
||||
if (current->context == current->suspend_context) current->context = NULL;
|
||||
if (current->context == current->suspend_context)
|
||||
{
|
||||
current->context = NULL;
|
||||
stop_thread_if_suspended( current );
|
||||
}
|
||||
current->suspend_context = NULL;
|
||||
}
|
||||
else set_error( STATUS_INVALID_PARAMETER ); /* not suspended, shouldn't happen */
|
||||
|
|
|
@ -106,6 +106,7 @@ extern struct thread *get_thread_from_handle( obj_handle_t handle, unsigned int
|
|||
extern struct thread *get_thread_from_tid( int tid );
|
||||
extern struct thread *get_thread_from_pid( int pid );
|
||||
extern void stop_thread( struct thread *thread );
|
||||
extern void stop_thread_if_suspended( struct thread *thread );
|
||||
extern int wake_thread( struct thread *thread );
|
||||
extern int add_queue( struct object *obj, struct wait_queue_entry *entry );
|
||||
extern void remove_queue( struct object *obj, struct wait_queue_entry *entry );
|
||||
|
|
Loading…
Reference in New Issue