commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r805669 - /commons/sandbox/runtime/trunk/src/main/native/os/win32/psema.c
Date Wed, 19 Aug 2009 05:55:32 GMT
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;
 



Mime
View raw message