mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 22:28:30 +00:00
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 },
|
/* 10 */ { 0, 0, TRUE },
|
||||||
{ 0, 0, FALSE },
|
{ 0, 0, FALSE },
|
||||||
{ 0, WAIT_TIMEOUT, 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 )
|
static void do_wait_idle_child( int arg )
|
||||||
{
|
{
|
||||||
WNDCLASS cls;
|
WNDCLASS cls;
|
||||||
MSG msg;
|
MSG msg;
|
||||||
HWND hwnd = 0;
|
HWND hwnd = 0;
|
||||||
|
HANDLE thread;
|
||||||
|
DWORD id;
|
||||||
HANDLE start_event = OpenEventA( EVENT_ALL_ACCESS, FALSE, "test_WaitForInputIdle_start" );
|
HANDLE start_event = OpenEventA( EVENT_ALL_ACCESS, FALSE, "test_WaitForInputIdle_start" );
|
||||||
HANDLE end_event = OpenEventA( EVENT_ALL_ACCESS, FALSE, "test_WaitForInputIdle_end" );
|
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 );
|
MsgWaitForMultipleObjects( 0, NULL, FALSE, 100, QS_ALLINPUT );
|
||||||
SetEvent( start_event );
|
SetEvent( start_event );
|
||||||
break;
|
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 );
|
WaitForSingleObject( end_event, 2000 );
|
||||||
CloseHandle( start_event );
|
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_state = STARTUP_IN_PROGRESS;
|
||||||
process->startup_info = NULL;
|
process->startup_info = NULL;
|
||||||
process->idle_event = NULL;
|
process->idle_event = NULL;
|
||||||
process->queue = NULL;
|
|
||||||
process->peb = 0;
|
process->peb = 0;
|
||||||
process->ldt_copy = 0;
|
process->ldt_copy = 0;
|
||||||
process->winstation = 0;
|
process->winstation = 0;
|
||||||
|
@ -423,7 +422,6 @@ static void process_destroy( struct object *obj )
|
||||||
if (process->msg_fd) release_object( process->msg_fd );
|
if (process->msg_fd) release_object( process->msg_fd );
|
||||||
list_remove( &process->entry );
|
list_remove( &process->entry );
|
||||||
if (process->idle_event) release_object( process->idle_event );
|
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->id) free_ptid( process->id );
|
||||||
if (process->token) release_object( process->token );
|
if (process->token) release_object( process->token );
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
|
|
||||||
struct msg_queue;
|
|
||||||
struct atom_table;
|
struct atom_table;
|
||||||
struct handle_table;
|
struct handle_table;
|
||||||
struct startup_info;
|
struct startup_info;
|
||||||
|
@ -75,7 +74,6 @@ struct process
|
||||||
enum startup_state startup_state; /* startup state */
|
enum startup_state startup_state; /* startup state */
|
||||||
struct startup_info *startup_info; /* startup info while init is in progress */
|
struct startup_info *startup_info; /* startup info while init is in progress */
|
||||||
struct event *idle_event; /* event for input idle */
|
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 winstation; /* main handle to process window station */
|
||||||
obj_handle_t desktop; /* handle to desktop to use for new threads */
|
obj_handle_t desktop; /* handle to desktop to use for new threads */
|
||||||
struct token *token; /* security token associated with this process */
|
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] );
|
for (i = 0; i < NB_MSG_KINDS; i++) list_init( &queue->msg_list[i] );
|
||||||
|
|
||||||
thread->queue = queue;
|
thread->queue = queue;
|
||||||
if (!thread->process->queue)
|
|
||||||
thread->process->queue = (struct msg_queue *)grab_object( queue );
|
|
||||||
}
|
}
|
||||||
release_object( input );
|
release_object( input );
|
||||||
return queue;
|
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 */
|
/* free the message queue of a thread at thread exit */
|
||||||
void free_msg_queue( struct thread *thread )
|
void free_msg_queue( struct thread *thread )
|
||||||
{
|
{
|
||||||
struct process *process = thread->process;
|
|
||||||
|
|
||||||
remove_thread_hooks( thread );
|
remove_thread_hooks( thread );
|
||||||
if (!thread->queue) return;
|
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 );
|
release_object( thread->queue );
|
||||||
thread->queue = NULL;
|
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 );
|
set_error( STATUS_ACCESS_DENIED );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* if waiting on the main process queue, set the idle event */
|
if (process->idle_event) set_event( process->idle_event );
|
||||||
if (process->queue == queue)
|
|
||||||
{
|
|
||||||
if (process->idle_event) set_event( process->idle_event );
|
|
||||||
}
|
|
||||||
if (queue->fd && list_empty( &obj->wait_queue )) /* first on the queue */
|
if (queue->fd && list_empty( &obj->wait_queue )) /* first on the queue */
|
||||||
set_fd_events( queue->fd, POLLIN );
|
set_fd_events( queue->fd, POLLIN );
|
||||||
add_queue( obj, entry );
|
add_queue( obj, entry );
|
||||||
|
|
Loading…
Reference in a new issue