Commit 31022d66 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 5501f127
......@@ -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 )
{
......
......@@ -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;
}
}
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment