Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 69E0B18CD for ; Tue, 19 Apr 2011 15:23:18 +0000 (UTC) Received: (qmail 4749 invoked by uid 500); 19 Apr 2011 15:23:18 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 4684 invoked by uid 500); 19 Apr 2011 15:23:18 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 4677 invoked by uid 99); 19 Apr 2011 15:23:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Apr 2011 15:23:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Apr 2011 15:23:17 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 03CDA2388A2C; Tue, 19 Apr 2011 15:22:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@commons.apache.org From: mturk@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110419152257.03CDA2388A2C@eris.apache.org> 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)