Alexandre Julliard : server: Any thread can set the idle event, don' t treat the first one differently.
Alexandre Julliard
julliard at winehq.org
Thu Dec 17 10:37:06 CST 2009
Module: wine
Branch: master
Commit: 7d4e28480d0ce4bc3286bf59349084f106465d8e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7d4e28480d0ce4bc3286bf59349084f106465d8e
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Dec 16 17:25:01 2009 +0100
server: Any thread can set the idle event, don't treat the first one differently.
---
dlls/user32/tests/msg.c | 21 +++++++++++++++++++++
server/process.c | 2 --
server/process.h | 2 --
server/queue.c | 16 ++--------------
4 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index d721bda..2d5477c 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -12041,13 +12041,26 @@ static const struct
/* 10 */ { 0, 0, TRUE },
{ 0, 0, FALSE },
{ 0, WAIT_TIMEOUT, FALSE },
+ { 0, 0, FALSE },
};
+static DWORD CALLBACK do_wait_idle_child_thread( void *arg )
+{
+ MSG msg;
+
+ PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE );
+ Sleep( 200 );
+ MsgWaitForMultipleObjects( 0, NULL, FALSE, 100, QS_ALLINPUT );
+ return 0;
+}
+
static void do_wait_idle_child( int arg )
{
WNDCLASS cls;
MSG msg;
HWND hwnd = 0;
+ HANDLE thread;
+ DWORD id;
HANDLE start_event = OpenEventA( EVENT_ALL_ACCESS, FALSE, "test_WaitForInputIdle_start" );
HANDLE end_event = OpenEventA( EVENT_ALL_ACCESS, FALSE, "test_WaitForInputIdle_end" );
@@ -12146,6 +12159,14 @@ static void do_wait_idle_child( int arg )
MsgWaitForMultipleObjects( 0, NULL, FALSE, 100, QS_ALLINPUT );
SetEvent( start_event );
break;
+ case 13:
+ SetEvent( start_event );
+ PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE );
+ Sleep( 200 );
+ thread = CreateThread( NULL, 0, do_wait_idle_child_thread, NULL, 0, &id );
+ WaitForSingleObject( thread, 10000 );
+ CloseHandle( thread );
+ break;
}
WaitForSingleObject( end_event, 2000 );
CloseHandle( start_event );
diff --git a/server/process.c b/server/process.c
index 8f47870..379bec6 100644
--- a/server/process.c
+++ b/server/process.c
@@ -328,7 +328,6 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
process->startup_state = STARTUP_IN_PROGRESS;
process->startup_info = NULL;
process->idle_event = NULL;
- process->queue = NULL;
process->peb = 0;
process->ldt_copy = 0;
process->winstation = 0;
@@ -423,7 +422,6 @@ static void process_destroy( struct object *obj )
if (process->msg_fd) release_object( process->msg_fd );
list_remove( &process->entry );
if (process->idle_event) release_object( process->idle_event );
- if (process->queue) release_object( process->queue );
if (process->id) free_ptid( process->id );
if (process->token) release_object( process->token );
}
diff --git a/server/process.h b/server/process.h
index 250c5ce..87e12e0 100644
--- a/server/process.h
+++ b/server/process.h
@@ -23,7 +23,6 @@
#include "object.h"
-struct msg_queue;
struct atom_table;
struct handle_table;
struct startup_info;
@@ -75,7 +74,6 @@ struct process
enum startup_state startup_state; /* startup state */
struct startup_info *startup_info; /* startup info while init is in progress */
struct event *idle_event; /* event for input idle */
- struct msg_queue *queue; /* main message queue */
obj_handle_t winstation; /* main handle to process window station */
obj_handle_t desktop; /* handle to desktop to use for new threads */
struct token *token; /* security token associated with this process */
diff --git a/server/queue.c b/server/queue.c
index 2c8140d..3b7b449 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -280,8 +280,6 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
for (i = 0; i < NB_MSG_KINDS; i++) list_init( &queue->msg_list[i] );
thread->queue = queue;
- if (!thread->process->queue)
- thread->process->queue = (struct msg_queue *)grab_object( queue );
}
release_object( input );
return queue;
@@ -290,15 +288,8 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
/* free the message queue of a thread at thread exit */
void free_msg_queue( struct thread *thread )
{
- struct process *process = thread->process;
-
remove_thread_hooks( thread );
if (!thread->queue) return;
- if (process->queue == thread->queue) /* is it the process main queue? */
- {
- release_object( process->queue );
- process->queue = NULL;
- }
release_object( thread->queue );
thread->queue = NULL;
}
@@ -780,11 +771,8 @@ static int msg_queue_add_queue( struct object *obj, struct wait_queue_entry *ent
set_error( STATUS_ACCESS_DENIED );
return 0;
}
- /* if waiting on the main process queue, set the idle event */
- if (process->queue == queue)
- {
- if (process->idle_event) set_event( process->idle_event );
- }
+ if (process->idle_event) set_event( process->idle_event );
+
if (queue->fd && list_empty( &obj->wait_queue )) /* first on the queue */
set_fd_events( queue->fd, POLLIN );
add_queue( obj, entry );
More information about the wine-cvs
mailing list