[geos-devel] Call Buffer on Geometry throws randomly AccessViolationException (in parallel use)

lmagniez lmagniez at articque.com
Tue Jul 1 00:36:51 PDT 2014


Hi,

I use GDAL 1.11 (with Geos 3.4) with C# wrapper.

My C# code below :

using System;
using System.Collections.Generic;
using OSGeo.OGR;
using System.ComponentModel;

namespace GDAL_mutlithread
{
  class Program
  {
    static void Main(string[] args)
    {
      // create backgroundWorkers to execute code in parallel
      List<BackgroundWorker> bws = new List<BackgroundWorker>();
      // 100 tasks in parallel
      for (int idx = 0; idx < 100; idx++)
      {
        BackgroundWorker bw = new BackgroundWorker();
        bws.Add(bw);
        bw.DoWork += new DoWorkEventHandler(bw_DoWork);
        bw.RunWorkerAsync(idx);
      }
      Console.ReadKey();
    }

    private static void bw_DoWork(object sender, DoWorkEventArgs e)
    {
      // my polygon as WKT format
      string poly1 = "POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))";
      // create Geometry object
      Geometry geom1 = OSGeo.OGR.Ogr.CreateGeometryFromWkt(ref poly1, null);
      // get Buffer
      for (int idx = 0; idx < 100; idx++)
      {
        geom1.Buffer(0, 1);
        // throws randomly Exception 
        // ==> An unhandled exception of type
'System.AccessViolationException' occurred in ogr_csharp.dll
      }
    }
  }
}

The Buffer function can't be called in parallel ?

Regards




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Call-Buffer-on-Geometry-throws-randomly-AccessViolationException-in-parallel-use-tp5148932.html
Sent from the GEOS Developers mailing list archive at Nabble.com.


More information about the geos-devel mailing list