[mapserver-commits] r12234 - trunk/mapserver/mapcache/src

svn at osgeo.org svn at osgeo.org
Fri Aug 26 07:09:25 EDT 2011


Author: tbonfort
Date: 2011-08-26 04:09:25 -0700 (Fri, 26 Aug 2011)
New Revision: 12234

Modified:
   trunk/mapserver/mapcache/src/lock.c
Log:
use symbolic links for blank tiles
closes issue 16.
thomas.bonfort | 2011-01-11 15:38:57 +0100 (Tue, 11 Jan 2011)

Modified: trunk/mapserver/mapcache/src/lock.c
===================================================================
--- trunk/mapserver/mapcache/src/lock.c	2011-08-26 11:09:21 UTC (rev 12233)
+++ trunk/mapserver/mapcache/src/lock.c	2011-08-26 11:09:25 UTC (rev 12234)
@@ -41,7 +41,7 @@
    char *lockname = geocache_tileset_tile_lock_key(ctx,tile);
    sem_t *lock;
    if ((lock = sem_open(lockname, O_CREAT|O_EXCL, 0644, 1)) == SEM_FAILED) {
-      ctx->set_error(ctx,GEOCACHE_MUTEX_ERROR, "failed to create pthread semaphore %s",lockname);
+      ctx->set_error(ctx,GEOCACHE_MUTEX_ERROR, "failed to create posix semaphore %s: %s",lockname, strerror(errno));
       return;
    }
    sem_wait(lock);
@@ -67,12 +67,10 @@
   sem_post(lock);
   /*check if the semaphore is held by others*/
   sem_getvalue(lock,&semvalue);
+  sem_close(lock);
   if(semvalue>0) {
      /*no one is using the lock, delete it*/
      sem_unlink(lockname);
-  } else {
-     /*just close it as others are using it*/
-     sem_close(lock);
   }
   tile->lock = NULL;
 }
@@ -134,10 +132,9 @@
      sem_wait(lock);
      sem_post(lock);
      sem_getvalue(lock,&semvalue);
+     sem_close(lock);
      if(semvalue>0) {
         sem_unlink(lockname);
-     } else {
-        sem_close(lock);
      }
   }
 }



More information about the mapserver-commits mailing list