[gdal-dev] PROJ context and threads

Even Rouault even.rouault at spatialys.com
Wed Apr 28 06:38:51 PDT 2021


We could have a OSRSetAutoclosePROJDatabase() global function that would 
call proj_context_set_autoclose_database() when it creates the 
per-thread PROJ context

==> ogr/ogr_proj_p.cpp

An alternative would be to enhance PROJ to have a mode where the SQLite3 
db handle would be shared amongst several contexts. In theory that could 
be possible as you can invoke sqlite3_open_v2() with 
SQLITE_OPEN_FULLMUTEX. But would require non completely trivial changes

Le 28/04/2021 à 15:30, Andrew Bell a écrit :
> On Tue, Apr 27, 2021 at 11:44 PM Alan Snow <alansnow21 at gmail.com 
> <mailto:alansnow21 at gmail.com>> wrote:
>
>     By default pyproj uses the autoclose option and provides this
>     option for users who want better performance and know they have a
>     single threaded application:
>     https://pyproj4.github.io/pyproj/stable/api/global_context.html
>     <https://pyproj4.github.io/pyproj/stable/api/global_context.html>
>
>
> Thanks for this!  But it appears that the PROJ context held by a 
> thread using GDAL is private, so I don't think I can call 
> proj_context_set_autoclose_database(). I think I'm going to have to 
> make sure that the thread actually terminates in order to release the 
> context.
>
> If someone has other suggestions, I'd be happy to hear them.
>
> -- 
> Andrew Bell
> andrew.bell.ia at gmail.com <mailto:andrew.bell.ia at gmail.com>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210428/b89a791f/attachment-0001.html>


More information about the gdal-dev mailing list