Suspended threads should not acquire synchronization objects.

This commit is contained in:
Peter Hunnisett 2003-02-28 21:50:47 +00:00 committed by Alexandre Julliard
parent e85357d639
commit a3c5ad4e77
3 changed files with 16 additions and 4 deletions

View File

@ -673,7 +673,11 @@ void resume_process( struct process *process )
while (thread) while (thread)
{ {
struct thread *next = thread->proc_next; struct thread *next = thread->proc_next;
if (!thread->suspend) continue_thread( thread ); if (!thread->suspend)
{
continue_thread( thread );
wake_thread( thread );
}
thread = next; thread = next;
} }
} }
@ -818,7 +822,7 @@ static void write_process_memory( struct process *process, int *addr, size_t len
if (!check_process_write_access( thread, addr, len )) if (!check_process_write_access( thread, addr, len ))
{ {
set_error( STATUS_ACCESS_DENIED ); set_error( STATUS_ACCESS_DENIED );
return; goto done;
} }
/* first word is special */ /* first word is special */
if (len > 1) if (len > 1)

View File

@ -319,7 +319,11 @@ int resume_thread( struct thread *thread )
int old_count = thread->suspend; int old_count = thread->suspend;
if (thread->suspend > 0) if (thread->suspend > 0)
{ {
if (!(--thread->suspend + thread->process->suspend)) continue_thread( thread ); if (!(--thread->suspend + thread->process->suspend))
{
continue_thread( thread );
wake_thread( thread );
}
} }
return old_count; return old_count;
} }
@ -403,6 +407,9 @@ static int check_wait( struct thread *thread )
struct thread_wait *wait = thread->wait; struct thread_wait *wait = thread->wait;
struct wait_queue_entry *entry = wait->queues; struct wait_queue_entry *entry = wait->queues;
/* Suspended threads may not acquire locks */
if( thread->process->suspend + thread->suspend > 0 ) return -1;
assert( wait ); assert( wait );
if (wait->flags & SELECT_ALL) if (wait->flags & SELECT_ALL)
{ {
@ -465,7 +472,7 @@ static int send_thread_wakeup( struct thread *thread, void *cookie, int signaled
/* attempt to wake up a thread */ /* attempt to wake up a thread */
/* return >0 if OK, 0 if the wait condition is still not satisfied */ /* return >0 if OK, 0 if the wait condition is still not satisfied */
static int wake_thread( struct thread *thread ) int wake_thread( struct thread *thread )
{ {
int signaled, count; int signaled, count;
void *cookie; void *cookie;

View File

@ -112,6 +112,7 @@ extern struct thread *get_thread_from_handle( obj_handle_t handle, unsigned int
extern struct thread *get_thread_from_pid( int pid ); extern struct thread *get_thread_from_pid( int pid );
extern int suspend_thread( struct thread *thread, int check_limit ); extern int suspend_thread( struct thread *thread, int check_limit );
extern int resume_thread( struct thread *thread ); extern int resume_thread( struct thread *thread );
extern int wake_thread( struct thread *thread );
extern int add_queue( struct object *obj, struct wait_queue_entry *entry ); extern int add_queue( struct object *obj, struct wait_queue_entry *entry );
extern void remove_queue( struct object *obj, struct wait_queue_entry *entry ); extern void remove_queue( struct object *obj, struct wait_queue_entry *entry );
extern void kill_thread( struct thread *thread, int violent_death ); extern void kill_thread( struct thread *thread, int violent_death );