[mapserver-commits] r12231 - trunk/mapserver/mapcache/src
svn at osgeo.org
svn at osgeo.org
Fri Aug 26 07:09:11 EDT 2011
Author: tbonfort
Date: 2011-08-26 04:09:11 -0700 (Fri, 26 Aug 2011)
New Revision: 12231
Modified:
trunk/mapserver/mapcache/src/lock.c
Log:
add hook for validating client requests. will be needed for restricted extents
thomas.bonfort | 2011-01-10 15:21:44 +0100 (Mon, 10 Jan 2011)
Modified: trunk/mapserver/mapcache/src/lock.c
===================================================================
--- trunk/mapserver/mapcache/src/lock.c 2011-08-26 11:09:08 UTC (rev 12230)
+++ trunk/mapserver/mapcache/src/lock.c 2011-08-26 11:09:11 UTC (rev 12231)
@@ -30,7 +30,9 @@
/**
* \brief lock the given tile so other processes know it is being processed
*
- * this function creates a file with a .lck extension and puts an exclusive lock on it
+ * this function call is protected by a mutex
+ *
+ * this function creates a named semaphore and aquires a lock on it
* \sa geocache_cache::tile_lock()
* \sa geocache_cache::tile_lock_exists()
* \private \memberof geocache_cache_disk
@@ -49,6 +51,8 @@
/**
* \brief unlock a previously locked tile
*
+ * this function call is protected by a mutex
+ *
* \sa geocache_cache::tile_unlock()
* \sa geocache_cache::tile_lock_exists()
*/
@@ -61,10 +65,13 @@
return;
}
sem_post(lock);
+ /*check if the semaphore is held by others*/
sem_getvalue(lock,&semvalue);
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;
@@ -72,6 +79,9 @@
/**
* \brief query tile to check if the corresponding lockfile exists
+ *
+ * this function call is protected by a mutex
+ *
* \sa geocache_cache::tile_lock()
* \sa geocache_cache::tile_unlock()
*/
More information about the mapserver-commits
mailing list