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 2009/08/19 07:55:32 UTC
svn commit: r805669 -
/commons/sandbox/runtime/trunk/src/main/native/os/win32/psema.c
Author: mturk
Date: Wed Aug 19 05:55:31 2009
New Revision: 805669
URL: http://svn.apache.org/viewvc?rev=805669&view=rev
Log:
Honor semaphore value
Modified:
commons/sandbox/runtime/trunk/src/main/native/os/win32/psema.c
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/psema.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/psema.c?rev=805669&r1=805668&r2=805669&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/psema.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/psema.c Wed Aug 19 05:55:31 2009
@@ -39,11 +39,16 @@
int value)
{
int rc;
+ int maxval = 32767;
HANDLE s;
SECURITY_ATTRIBUTES sa;
wchar_t *reskey;
wchar_t keybuf[128];
+ if (value < 1) {
+ ACR_SET_OS_ERROR(ACR_EINVAL);
+ return -1;
+ }
if (name == NULL) {
reskey = NULL;
}
@@ -60,8 +65,9 @@
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = FALSE;
-
- s = CreateSemaphoreW(&sa, 1, 32767, reskey);
+ if (value > maxval)
+ maxval = value;
+ s = CreateSemaphoreW(&sa, (LONG)value, (LONG)maxval, reskey);
if (!s)
return -1;