Signal and release the idle event when the process main thread exits.

This commit is contained in:
Alexandre Julliard 2002-08-16 23:30:41 +00:00
parent 5501f127df
commit 31022d66ca
3 changed files with 23 additions and 11 deletions

View File

@ -163,6 +163,27 @@ static struct msg_queue *create_msg_queue( struct thread *thread )
return queue;
}
/* free the message queue of a thread at thread exit */
void free_msg_queue( struct thread *thread )
{
struct process *process = thread->process;
if (!thread->queue) return;
if (process->queue == thread->queue) /* is it the process main queue? */
{
release_object( process->queue );
process->queue = NULL;
if (process->idle_event)
{
set_event( process->idle_event );
release_object( process->idle_event );
process->idle_event = NULL;
}
}
release_object( thread->queue );
thread->queue = NULL;
}
/* check the queue status */
inline static int is_signaled( struct msg_queue *queue )
{

View File

@ -187,16 +187,7 @@ static void cleanup_thread( struct thread *thread )
if (thread->request_fd != -1) close( thread->request_fd );
if (thread->reply_fd != -1) close( thread->reply_fd );
if (thread->wait_fd != -1) close( thread->wait_fd );
if (thread->queue)
{
if (thread->process->queue == thread->queue)
{
release_object( thread->process->queue );
thread->process->queue = NULL;
}
release_object( thread->queue );
thread->queue = NULL;
}
free_msg_queue( thread );
destroy_thread_windows( thread );
for (i = 0; i < MAX_INFLIGHT_FDS; i++)
{
@ -795,7 +786,6 @@ DECL_HANDLER(new_thread)
return;
}
kill_thread( thread, 1 );
request_fd = -1;
}
}

View File

@ -43,6 +43,7 @@ extern void *next_user_handle( user_handle_t *handle, enum user_object type );
/* queue functions */
extern void free_msg_queue( struct thread *thread );
extern void inc_queue_paint_count( struct thread *thread, int incr );
extern void queue_cleanup_window( struct thread *thread, user_handle_t win );
extern void post_message( user_handle_t win, unsigned int message,