server: Any thread can set the idle event, don't treat the first one differently.
This commit is contained in:
parent
b57cc5561b
commit
7d4e28480d
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in New Issue