[MetaCRS] CsMap Threading

Norman Barker norman.barker at gmail.com
Thu May 9 16:18:40 PDT 2013


Hi Andre,

great, thanks for the help. I was able to use the mutex functions in the
Erlang Driver and added them here

https://github.com/cloudant/erl_spatial/blob/master/c_src/spatialindex.cc

At the moment I am just creating a lock around all CsMap calls.

>From your email and reading RFC 5 it seems that when I do an EPSG code
lookup (as it uses the dictionary and has a static buffer) that I have to
lock, and then for each transformation there is a property that says
whether it is rentrant or not. It looks from the MapGuide code that I
should also check for no-ops when source crs and target crs are the same.

It seems to be very quick even with my generic locks, the radius search is
great.

thanks for the help.

Norman


On Thu, May 9, 2013 at 2:44 AM, Andre Barth <Andre.Barth at autodesk.com>wrote:

>  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>
> 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/2474d196/attachment.html>


More information about the MetaCRS mailing list