[mapserver-commits] r7428 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Mon Mar 3 21:18:48 EST 2008
Author: warmerdam
Date: 2008-03-03 21:18:47 -0500 (Mon, 03 Mar 2008)
New Revision: 7428
Modified:
trunk/mapserver/mapproject.c
trunk/mapserver/mapresample.c
Log:
acquire PROJ lock for all pj_transform() calls (#2533)
Modified: trunk/mapserver/mapproject.c
===================================================================
--- trunk/mapserver/mapproject.c 2008-03-03 20:10:57 UTC (rev 7427)
+++ trunk/mapserver/mapproject.c 2008-03-04 02:18:47 UTC (rev 7428)
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id:$
+ * $Id$
*
* Project: MapServer
* Purpose: projectionObj / PROJ.4 interface.
@@ -29,6 +29,7 @@
#include "mapserver.h"
#include "mapproject.h"
+#include "mapthread.h"
#include <assert.h>
MS_CVSID("$Id$")
@@ -87,8 +88,10 @@
point->y *= DEG_TO_RAD;
}
+ msAcquireLock( TLOCK_PROJ );
error = pj_transform( in->proj, out->proj, 1, 0,
&(point->x), &(point->y), &z );
+ msReleaseLock( TLOCK_PROJ );
if( error || point->x == HUGE_VAL || point->y == HUGE_VAL )
return MS_FAILURE;
Modified: trunk/mapserver/mapresample.c
===================================================================
--- trunk/mapserver/mapresample.c 2008-03-03 20:10:57 UTC (rev 7427)
+++ trunk/mapserver/mapresample.c 2008-03-04 02:18:47 UTC (rev 7428)
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id:$
+ * $Id$
*
* Project: MapServer
* Purpose: Assorted code related to resampling rasters.
@@ -29,6 +29,7 @@
#include <assert.h>
#include "mapresample.h"
+#include "mapthread.h"
MS_CVSID("$Id$")
@@ -1038,10 +1039,16 @@
if( psPTInfo->bUseProj )
{
double *z;
+ int tr_result;
z = (double *) calloc(sizeof(double),nPoints);
- if( pj_transform( psPTInfo->psDstProj, psPTInfo->psSrcProj,
- nPoints, 1, x, y, z) != 0 )
+
+ msAcquireLock( TLOCK_PROJ );
+ tr_result = pj_transform( psPTInfo->psDstProj, psPTInfo->psSrcProj,
+ nPoints, 1, x, y, z);
+ msReleaseLock( TLOCK_PROJ );
+
+ if( tr_result != 0 )
{
free( z );
for( i = 0; i < nPoints; i++ )
@@ -1322,6 +1329,8 @@
/* -------------------------------------------------------------------- */
if( psDstProj->proj && psSrcProj->proj )
{
+ int tr_result;
+
if( pj_is_latlong(psDstProj->proj) )
{
for( i = 0; i < nSamples; i++ )
@@ -1331,11 +1340,13 @@
}
}
- if( pj_transform( psDstProj->proj, psSrcProj->proj,
- nSamples, 1, x, y, z ) != 0 )
- {
+ msAcquireLock( TLOCK_PROJ );
+ tr_result = pj_transform( psDstProj->proj, psSrcProj->proj,
+ nSamples, 1, x, y, z );
+ msReleaseLock( TLOCK_PROJ );
+
+ if( tr_result != 0 )
return MS_FALSE;
- }
if( pj_is_latlong(psSrcProj->proj) )
{
More information about the mapserver-commits
mailing list