commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r806467 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/Mutex.java native/os/darwin/pmutex.c native/os/unix/pmutex.c native/os/win32/pmutex.c
Date Fri, 21 Aug 2009 09:03:26 GMT
Author: mturk
Date: Fri Aug 21 09:03:25 2009
New Revision: 806467

URL: http://svn.apache.org/viewvc?rev=806467&view=rev
Log:
Add Mutex.remove mathod. Usable for platforms that have kernel persistent mutexes

Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Mutex.java
    commons/sandbox/runtime/trunk/src/main/native/os/darwin/pmutex.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/pmutex.c

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Mutex.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Mutex.java?rev=806467&r1=806466&r2=806467&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Mutex.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Mutex.java Fri
Aug 21 09:03:25 2009
@@ -170,5 +170,28 @@
         }
     }
 
+    private static native int remove0(String name)
+        throws IOException, SecurityException;
+    /**
+     * Remove mutex associated with a {@code file}.
+     * <p>
+     * This function is only supported on platforms which support
+     * name-based mutexes.
+     * </p>
+     * @param file The abstract file path associated with mutex
+     *             object which needs to be removed.
+     */
+    public static boolean remove(File file)
+        throws IOException, SecurityException
+    {
+        int rc;
+
+        rc = remove0(file.getPath());
+        if (rc == Status.OK)
+            return true;
+        else
+            return false;
+    }
+
 }
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/darwin/pmutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/darwin/pmutex.c?rev=806467&r1=806466&r2=806467&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/darwin/pmutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/darwin/pmutex.c Fri Aug 21 09:03:25 2009
@@ -749,3 +749,16 @@
     return mtxo;
 }
 
+ACR_JNI_EXPORT_DECLARE(jint, Mutex, remove0)(ACR_JNISTDARGS,
+                                             jstring name)
+{
+
+    int rc = ACR_SUCCESS;
+    UNREFERENCED_O;
+
+    WITH_CSTR(name) {
+        rc = ACR_ProcMutexRemove(_E, J2S(name));
+    } END_WITH_CSTR(name);
+    return rc;
+}
+

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c?rev=806467&r1=806466&r2=806467&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c Fri Aug 21 09:03:25 2009
@@ -79,22 +79,6 @@
 #endif
 };
 
-ACR_CLASS_LDEF(Mutex)
-{
-    int rv;
-
-    if ((rv = ACR_LoadClass(_E, &_clazzn, 0)) != ACR_SUCCESS)
-        return rv;
-    J_LOAD_METHOD(0000);
-
-    return ACR_SUCCESS;
-}
-
-ACR_CLASS_UDEF(Mutex)
-{
-    ACR_UnloadClass(_E, &_clazzn);
-}
-
 #if defined(ACR_USE_SYSV_MUTEX)
 
 static int mutex_owner_cleanup(void *mutex, int type, unsigned int flags)
@@ -641,6 +625,25 @@
 
 #endif  /* ACR_USE_SYSV_MUTEX */
 
+/* Java API
+ */
+
+ACR_CLASS_LDEF(Mutex)
+{
+    int rv;
+
+    if ((rv = ACR_LoadClass(_E, &_clazzn, 0)) != ACR_SUCCESS)
+        return rv;
+    J_LOAD_METHOD(0000);
+
+    return ACR_SUCCESS;
+}
+
+ACR_CLASS_UDEF(Mutex)
+{
+    ACR_UnloadClass(_E, &_clazzn);
+}
+
 static int mtx_descriptor_cleanup(ACR_JNISTDARGS,
                                   acr_descriptor_cb_type_e cm,
                                   acr_descriptor_cb_t *dp)
@@ -742,3 +745,16 @@
     return mtxo;
 }
 
+ACR_JNI_EXPORT_DECLARE(jint, Mutex, remove0)(ACR_JNISTDARGS,
+                                             jstring name)
+{
+
+    int rc = ACR_SUCCESS;
+    UNREFERENCED_O;
+
+    WITH_CSTR(name) {
+        rc = ACR_ProcMutexRemove(_E, J2S(name));
+    } END_WITH_CSTR(name);
+    return rc;
+}
+

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/pmutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/pmutex.c?rev=806467&r1=806466&r2=806467&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/pmutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/pmutex.c Fri Aug 21 09:03:25 2009
@@ -309,3 +309,10 @@
     return mtxo;
 }
 
+ACR_JNI_EXPORT_DECLARE(jint, Mutex, remove0)(ACR_JNISTDARGS,
+                                             jstring name)
+{
+    UNREFERENCED_STDARGS;
+    return ACR_ENOTIMPL;
+}
+



Mime
View raw message