[MetaCRS] CsMap Threading

Andre Barth Andre.Barth at autodesk.com
Thu May 9 01:44:50 PDT 2013


Hi Norman,

You're right - CsMap uses a lot of static variables - that's for historical reasons.
In particular, you cannot access the dictionaries from multiple threads - unless you've the appropriate locking mechanisms in place.

Having said that, you can run most transformations (and only such) in parallel though.

As an example on how to use that CsMap, take a look at this file:
http://svn.osgeo.org/mapguide/trunk/MgDev/Common/CoordinateSystem/CoordSysTransform.cpp

Search for [m_bIsReentrant]
(initialized in void CCoordinateSystemTransform::SetSourceAndTarget(MgCoordinateSystem* pSource, MgCoordinateSystem* pTarget))

and this type of code:

CriticalClass.Enter();
            status = TransformPoint3D (dCoords);
CriticalClass.Leave();


Thanks,
André

From: metacrs-bounces at lists.osgeo.org [mailto:metacrs-bounces at lists.osgeo.org] On Behalf Of Norman Barker
Sent: Thursday, May 9, 2013 2:25 AM
To: metacrs at lists.osgeo.org
Subject: Re: [MetaCRS] CsMap Threading

I am guessing this is my issue

/******* NOTE *****88  static array could cause multi-thread problems */

in const char* CSepsg2adskCS (long epsgNbr)

oops, I will look more into this, but I am relieved to have found it.

Norman

On Wed, May 8, 2013 at 5:32 PM, Norman Barker <norman.barker at gmail.com<mailto:norman.barker at gmail.com>> wrote:
Hi,

when I start getting 20 threads or so into the CsMap library I get weird errors with retrieving ellipsoid and crs definitions such as

Ellipsoid definition WGS84 does not exist.

or

 is not a valid key name

(where I am guessing key has been interpreted as "")

which it does for the other threads.

Any ideas? I am a little stumped. My next approach is to add more debug to CsMap.

thanks,

Norman

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/metacrs/attachments/20130509/de480ce0/attachment.html>


More information about the MetaCRS mailing list