[gdal-dev] Is OGR Buffer(...) thread safe in C#?
Casper Børgesen (CABO)
CABO at NIRAS.DK
Mon Jul 4 07:23:34 PDT 2016
Hi
I was just trying to parallelize buffering of a large set of polygons using GDAL 2.1 in C#.
My code is something like the following:
List<Geometry> polygonList = List of polygons...
var result = new ConcurrentBag<Geometry>();
Parallel.ForEach(polygonList, polygon =>
{
var polygonBuffer = polygon.Buffer(1, 1);
result.Add(polygonBuffer);
});
I get a System.AccessViolationException in ogr_csharp.dll on the Buffer(...) line. Since my method runs fine using a normal foreach or if I omit the Buffer(...) method, I assume it has something to do with thread safety and OGR.
So is my problem just that OGR Buffer(...) isn't thread safe or am I doing something wrong here?
Regards, Casper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160704/4b3dfce4/attachment.html>
More information about the gdal-dev
mailing list