commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r806307 - in /commons/sandbox/runtime/trunk/src/main/native/os/unix: pmutex.c psema.c
Date Thu, 20 Aug 2009 19:09:38 GMT
Author: mturk
Date: Thu Aug 20 19:09:37 2009
New Revision: 806307

URL: http://svn.apache.org/viewvc?rev=806307&view=rev
Log:
Simplify generating semaphore tmp name

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c

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=806307&r1=806306&r2=806307&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 Thu Aug 20 19:09:37 2009
@@ -73,7 +73,6 @@
 
 ACR_DECLARE(int) ACR_ProcMutexCreate(JNIEnv *_E, const acr_pchar_t *name)
 {
-    unsigned int ic = _mtx_counter;
     int rc = 0;
     acr_pmutex_t *m;
     char *p;
@@ -82,8 +81,7 @@
     if (!m)
         return -1;
     if (!name)
-        sprintf(m->name, "/AcM.%06x%02x", ((unsigned int)getpid() & 0xFFFFFF),
-                                          _mtx_counter++);
+        sprintf(m->name, "/AcM.%08x", _mtx_counter++);
     else {
         if (*name != '/')
             m->name[0] = '/';
@@ -103,11 +101,7 @@
                 m->name[13] = '\0';
                 continue;
             } else if (errno == EEXIST && !name) {
-                if ((_mtx_counter - ic) > 10)
-                    goto finally;
-                sprintf(m->name, "/AcM.%06x%02x",
-                        ((unsigned int)getpid() & 0xFFFFFF),
-                        _mtx_counter++);
+                sprintf(m->name, "/AcM.%08x", _mtx_counter++);
                 rc = 0;
             }
         }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c?rev=806307&r1=806306&r2=806307&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c Thu Aug 20 19:09:37 2009
@@ -74,7 +74,6 @@
 ACR_DECLARE(int) ACR_SemaphoreCreate(JNIEnv *_E, const acr_pchar_t *name,
                                      int value)
 {
-    unsigned int ic = _sem_counter;
     int rc = 0;
     acr_semaphore_t *s;
     char *p;
@@ -83,8 +82,7 @@
     if (!s)
         return -1;
     if (!name)
-        sprintf(s->name, "/AcS.%06x%02x", ((unsigned int)getpid() & 0xFFFFFF),
-                                          _sem_counter++);
+        sprintf(s->name, "/AcS.%08x", _sem_counter++);
     else {
         if (*name != '/')
             s->name[0] = '/';
@@ -104,11 +102,7 @@
                 s->name[13] = '\0';
                 continue;
             } else if (errno == EEXIST && !name) {
-                if ((_sem_counter - ic) > 10)
-                    goto finally;
-                sprintf(s->name, "/AcS.%06x%02x",
-                        ((unsigned int)getpid() & 0xFFFFFF),
-                        _sem_counter++);
+                sprintf(s->name, "/AcS.%08x", _sem_counter++);
                 rc = 0;
             }
         }



Mime
View raw message