[gdal-dev] OGRCoordinateTransformation Thread Safety
Even Rouault
even.rouault at spatialys.com
Thu Nov 7 08:47:46 PST 2019
On jeudi 7 novembre 2019 08:49:06 CET Bryant wrote:
> Thank you for the response Even!
>
> >As most C/C++ libraries, an object is not thread-safe unless it is
>
> explicitly mentioned it is.
>
> This makes sense.
> However, I inferred from one of your previous responses
> <http://osgeo-org.1560.x6.nabble.com/gdal-dev-Possible-concurrency-issue-in-> OGRCoordinateTransformation-tp5285641.html>
> that OGRCoordinateTransformation is reentrant:
> >You need to have one coordinate transform object per thread.
>
> where reentrant means
> <https://gdal.org/development/rfc/rfc16_ogr_reentrancy.html>
>
> >Reentrant: A reentrant function can be called simultaneously by multiple
>
> threads provided that each invocation of the function references unique
> data.
> - from the docs
> <https://gdal.org/development/rfc/rfc16_ogr_reentrancy.html>
>
> Is this inference correct
I'm always confused by the thread-safe vs reentrant terminology, but my
today's statement was to be interpreted in the meaning of RFC16 you quote: you
can use several OGRCoordinateTransformation instances from different threads,
provided that you don't use the same OGRCoordinateTransformation instance in
several threads simultaneously
> and, if so, where is this stated in the docs for
> OGRCoordinateTransformation?
Nowhere. We can't possibly document that on all objects. This is mostly the
default behaviour of all C/C++ libs I know. Feel free to submit a pull request
if you feel like it should be documented for that case however.
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list