commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1095113 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/platform/unix/SysVMutex.java native/os/unix/procmutex.c
Date Tue, 19 Apr 2011 15:22:56 GMT
Author: mturk
Date: Tue Apr 19 15:22:56 2011
New Revision: 1095113

URL: http://svn.apache.org/viewvc?rev=1095113&view=rev
Log:
Silently release the mutex on close

Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SysVMutex.java
    commons/sandbox/runtime/trunk/src/main/native/os/unix/procmutex.c

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SysVMutex.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SysVMutex.java?rev=1095113&r1=1095112&r2=1095113&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SysVMutex.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SysVMutex.java
Tue Apr 19 15:22:56 2011
@@ -112,7 +112,6 @@ final class SysVMutex extends Mutex
         int rc;
         if (fd == -1)
             throw new ClosedDescriptorException();
-        release0(fd);
         close0(fd);
         if (owner) {
             // Unlink if we are the semaphore owner.

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/procmutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/procmutex.c?rev=1095113&r1=1095112&r2=1095113&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/procmutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/procmutex.c Tue Apr 19 15:22:56
2011
@@ -222,7 +222,16 @@ cleanup:
 
 ACR_UNX_EXPORT(jint, SysVMutex, close0)(JNI_STDARGS, jint fd)
 {
-    union semun ick;
+    int    rc;
+    union  semun ick;
+    struct sembuf op;
+
+    op.sem_num = 0;
+    op.sem_op  = 1;
+    op.sem_flg = SEM_UNDO;
+    do {
+        rc = semop(fd, &op, 1);
+    } while (rc == -1 && errno == EINTR);
 
     ick.val = 0;
     if (semctl(fd, 0, IPC_RMID, ick) == 0)



Mime
View raw message