[mapserver-commits] r12274 - trunk/mapserver/mapcache/src
svn at osgeo.org
svn at osgeo.org
Fri Aug 26 07:13:01 EDT 2011
Author: tbonfort
Date: 2011-08-26 04:13:01 -0700 (Fri, 26 Aug 2011)
New Revision: 12274
Modified:
trunk/mapserver/mapcache/src/lock.c
Log:
remove logging to stdout in sedder
thomas.bonfort | 2011-01-19 18:52:27 +0100 (Wed, 19 Jan 2011)
Modified: trunk/mapserver/mapcache/src/lock.c
===================================================================
--- trunk/mapserver/mapcache/src/lock.c 2011-08-26 11:12:57 UTC (rev 12273)
+++ trunk/mapserver/mapcache/src/lock.c 2011-08-26 11:13:01 UTC (rev 12274)
@@ -21,11 +21,32 @@
#include <errno.h>
#include <fcntl.h>
+
+static const char *alphabet = "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789"
+ "_";
+static int encbase = 63; /* 26 + 26+ 10 + 1 */
+
+static char* num_encode(apr_pool_t *pool, int num) {
+ int n = num,r;
+ int i = 0;
+ char *ret = apr_pcalloc(pool,10); /* allocate 10 chars, should be amply sufficient */
+ while(1) {
+ r = n % encbase;
+ n = n / encbase;
+ ret[i] = alphabet[r];
+ if(n==0) break;
+ i++;
+ }
+ return ret;
+}
+
char *geocache_tileset_tile_lock_key(geocache_context *ctx, geocache_tile *tile) {
return apr_psprintf(ctx->pool,
- "/%s%d-%d-%d",
+ "/%s%s-%s-%s",
tile->tileset->name,
- tile->z, tile->y, tile->x);
+ num_encode(ctx->pool,tile->z), num_encode(ctx->pool,tile->y), num_encode(ctx->pool,tile->x));
}
/**
* \brief lock the given tile so other processes know it is being processed
@@ -44,6 +65,7 @@
ctx->set_error(ctx,500, "failed to create posix semaphore %s: %s",lockname, strerror(errno));
return;
}
+ ctx->log(ctx,GEOCACHE_DEBUG,"lock name is %s",lockname);
sem_wait(lock);
tile->lock = lock;
}
More information about the mapserver-commits
mailing list