You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2010/01/13 15:35:18 UTC
svn commit: r898772 - in /commons/sandbox/runtime/trunk/src/main/native:
include/arch/windows/acr_arch_private.h os/win32/exec.c
Author: mturk
Date: Wed Jan 13 14:35:18 2010
New Revision: 898772
URL: http://svn.apache.org/viewvc?rev=898772&view=rev
Log:
Add multiple object waiter inline
Modified:
commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h
commons/sandbox/runtime/trunk/src/main/native/os/win32/exec.c
Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h?rev=898772&r1=898771&r2=898772&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h Wed Jan 13 14:35:18 2010
@@ -219,6 +219,7 @@
#define WAIT_OBJECT_2 (WAIT_OBJECT_0 + 2)
#define WAIT_OBJECT_3 (WAIT_OBJECT_0 + 3)
#define WAIT_OBJECT_4 (WAIT_OBJECT_0 + 4)
+
static ACR_INLINE DWORD ACR_WaitForObjectOrSignal(HANDLE handle, DWORD dwTimeout)
{
DWORD rc;
@@ -232,6 +233,26 @@
return rc;
}
+static ACR_INLINE DWORD ACR_WaitForMultipleObjectOrSignal(DWORD nCount,
+ const HANDLE *handles,
+ DWORD dwTimeout)
+{
+ DWORD rc;
+ DWORD wn;
+ HANDLE wh[MAXIMUM_WAIT_OBJECTS];
+
+ wh[0] = sig_raised_event;
+ for (wn = 0; wn < nCount; wn++) {
+ if (wn > (MAXIMUM_WAIT_OBJECTS - 2))
+ break;
+ wh[wn + 1] = handles[wn];
+ }
+ ACR_SIG_WAITER_INIT();
+ rc = WaitForMultipleObjectsEx(wn + 1, wh, FALSE, dwTimeout, TRUE);
+ ACR_SIG_WAITER_DONE();
+ return rc;
+}
+
/**
* Heap allocation from main.c
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/exec.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/exec.c?rev=898772&r1=898771&r2=898772&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/exec.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/exec.c Wed Jan 13 14:35:18 2010
@@ -344,7 +344,6 @@
}
/* Setup wait handles
*/
- waith[waitn++] = sig_raised_event;
waith[waitn++] = pi.hProcess;
if (IS_VALID_HANDLE(pipes[PIPE_STDOUT_RDS])) {
ob[0].o.hEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
@@ -372,9 +371,7 @@
DWORD dwTimeout = ep->limit.timeout > 0 ? PROC_TIMEOUT_STEP : INFINITE;
DWORD ws;
- ACR_SIG_WAITER_INIT();
- ws = WaitForMultipleObjectsEx(waitn, waith, FALSE, dwTimeout, TRUE);
- ACR_SIG_WAITER_DONE();
+ ws = ACR_WaitForMultipleObjectOrSignal(waitn, waith, dwTimeout);
switch (ws) {
case WAIT_IO_COMPLETION:
case WAIT_ABANDONED_0: