Commit 748ff0f9 authored by Alexandre Julliard's avatar Alexandre Julliard

Changed server wait logic a bit.

parent b2340eaa
...@@ -64,6 +64,7 @@ typedef struct ...@@ -64,6 +64,7 @@ typedef struct
DWORD signaled; /* Index of signaled object (or WAIT_FAILED)*/ DWORD signaled; /* Index of signaled object (or WAIT_FAILED)*/
BOOL32 wait_all; /* Wait for all objects flag */ BOOL32 wait_all; /* Wait for all objects flag */
BOOL32 wait_msg; /* Wait for message flag */ BOOL32 wait_msg; /* Wait for message flag */
BOOL32 use_server; /* Use server call for waiting */
K32OBJ *objs[MAXIMUM_WAIT_OBJECTS]; /* Object pointers */ K32OBJ *objs[MAXIMUM_WAIT_OBJECTS]; /* Object pointers */
int server[MAXIMUM_WAIT_OBJECTS]; /* Server handles */ int server[MAXIMUM_WAIT_OBJECTS]; /* Server handles */
} WAIT_STRUCT; } WAIT_STRUCT;
......
...@@ -24,7 +24,7 @@ static BOOL32 SYNC_BuildWaitStruct( DWORD count, const HANDLE32 *handles, ...@@ -24,7 +24,7 @@ static BOOL32 SYNC_BuildWaitStruct( DWORD count, const HANDLE32 *handles,
BOOL32 wait_all, BOOL32 wait_msg, BOOL32 wait_all, BOOL32 wait_msg,
WAIT_STRUCT *wait ) WAIT_STRUCT *wait )
{ {
DWORD i; DWORD i, j;
K32OBJ **ptr; K32OBJ **ptr;
SYSTEM_LOCK(); SYSTEM_LOCK();
...@@ -32,6 +32,7 @@ static BOOL32 SYNC_BuildWaitStruct( DWORD count, const HANDLE32 *handles, ...@@ -32,6 +32,7 @@ static BOOL32 SYNC_BuildWaitStruct( DWORD count, const HANDLE32 *handles,
wait->signaled = WAIT_FAILED; wait->signaled = WAIT_FAILED;
wait->wait_all = wait_all; wait->wait_all = wait_all;
wait->wait_msg = wait_msg; wait->wait_msg = wait_msg;
wait->use_server = TRUE;
for (i = 0, ptr = wait->objs; i < count; i++, ptr++) for (i = 0, ptr = wait->objs; i < count; i++, ptr++)
{ {
if (!(*ptr = HANDLE_GetObjPtr( PROCESS_Current(), handles[i], if (!(*ptr = HANDLE_GetObjPtr( PROCESS_Current(), handles[i],
...@@ -41,16 +42,29 @@ static BOOL32 SYNC_BuildWaitStruct( DWORD count, const HANDLE32 *handles, ...@@ -41,16 +42,29 @@ static BOOL32 SYNC_BuildWaitStruct( DWORD count, const HANDLE32 *handles,
ERR(win32, "Bad handle %08x\n", handles[i]); ERR(win32, "Bad handle %08x\n", handles[i]);
break; break;
} }
if (!K32OBJ_OPS( *ptr )->signaled) if (wait->server[i] == -1)
{ {
/* This object type cannot be waited upon */ WARN(win32,"No server handle for %08x (type %d)\n",
ERR(win32, "Cannot wait on handle %08x\n", handles[i]); handles[i], (*ptr)->type );
K32OBJ_DecCount( *ptr ); wait->use_server = FALSE;
break;
} }
}
if (!wait->use_server)
{
for (j = 0, ptr = wait->objs; j < i; j++, ptr++)
{
if (!K32OBJ_OPS( *ptr )->signaled)
{
/* This object type cannot be waited upon */
ERR(win32, "Cannot wait on handle %08x\n", handles[j]);
break;
}
}
} }
if (i != count) else j = count;
if ((i != count) || (j != count))
{ {
/* There was an error */ /* There was an error */
wait->wait_msg = FALSE; wait->wait_msg = FALSE;
...@@ -317,11 +331,8 @@ DWORD SYNC_DoWait( DWORD count, const HANDLE32 *handles, ...@@ -317,11 +331,8 @@ DWORD SYNC_DoWait( DWORD count, const HANDLE32 *handles,
wait->signaled = WAIT_FAILED; wait->signaled = WAIT_FAILED;
else else
{ {
int i;
/* Check if we can use a server wait */ /* Check if we can use a server wait */
for (i = 0; i < count; i++) if (wait->use_server)
if (wait->server[i] == -1) break;
if (i == count)
{ {
int flags = 0; int flags = 0;
SYSTEM_UNLOCK(); SYSTEM_UNLOCK();
......
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