<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi,<br>
      thank you for your answer.<br>
    </p>
    <p>I am using the C API, and your macro allowed me to find a few
      places where I was using non-reentrant functions.<br>
      After recompiling, the code still fails if I remove the <tt>critical</tt>
      section, though.<br>
      Unfortunately, the code of the simulator is quite complex so I
      cannot really provide a MWE, the best I can give is what is on the
      SO post and the backtrace.</p>
    <p>The new backtrace reads:</p>
    <blockquote>
      <p><tt>Thread 22 "python" received signal SIGSEGV, Segmentation
          fault.</tt><tt><br>
        </tt><tt>[Switching to Thread 0x7fffa126e700 (LWP 6548)]</tt><tt><br>
        </tt><tt>0x00007fffa220fb35 in
          geos::noding::MCIndexSegmentSetMutualIntersector::intersectChains()
          () from /usr/lib/libgeos-3.6.2.so</tt><tt><br>
        </tt><tt>(gdb) bt</tt><tt><br>
        </tt><tt>#0  0x00007fffa220fb35 in
          geos::noding::MCIndexSegmentSetMutualIntersector::intersectChains()
          () from /usr/lib/libgeos-3.6.2.so</tt><tt><br>
        </tt><tt>#1  0x00007fffa220d661 in
geos::noding::FastSegmentSetIntersectionFinder::intersects(std::vector<geos::noding::SegmentString
          const*, std::allocator<geos::noding::SegmentString
          const*> >*, geos::noding::SegmentIntersectionDetector*)
          ()</tt><tt><br>
        </tt><tt>   from /usr/lib/libgeos-3.6.2.so</tt><tt><br>
        </tt><tt>#2  0x00007fffa220d6d5 in
geos::noding::FastSegmentSetIntersectionFinder::intersects(std::vector<geos::noding::SegmentString
          const*, std::allocator<geos::noding::SegmentString
          const*> >*) () from /usr/lib/libgeos-3.6.2.so</tt><tt><br>
        </tt><tt>#3  0x00007fffa21d55ca in
geos::geom::prep::PreparedLineStringIntersects::intersects(geos::geom::Geometry
          const*) const () from /usr/lib/libgeos-3.6.2.so</tt><tt><br>
        </tt><tt>#4  0x00007fffa21d4f96 in
          geos::geom::prep::PreparedLineString::intersects(geos::geom::Geometry
          const*) const () from /usr/lib/libgeos-3.6.2.so</tt><tt><br>
        </tt><tt>#5  0x00007fffa24df380 in GEOSPreparedIntersects_r ()</tt><tt><br>
        </tt><tt>   from /usr/lib/libgeos_c.so.1</tt><tt><br>
        </tt><tt>#6  0x00007fffa27e391b in
          growth::SpaceManager::env_intersect (</tt><tt><br>
        </tt><tt>    this=0x555555f68918, line=std::shared_ptr (count 1,
          weak 0) 0x7fff8c001430)</tt><tt><br>
        </tt><tt>    at
          /home/tfardet/Documents/GitLabo/Growth/src/kernel/space_manager.cpp:122</tt></p>
    </blockquote>
    <p>L122 is in the code on the <a moz-do-not-send="true"
href="https://stackoverflow.com/questions/47182166/segfault-when-testing-the-intersection-with-geos-in-parallel">SO
        post</a>. Hope this helps.</p>
    <p>In the meantime, I will try generating one <tt>PreparedGeometry
      </tt>object per thread to see if this helps.</p>
    <p>Best,<br>
      Tanguy<br>
    </p>
    <br>
    <div class="moz-cite-prefix">Le 23/11/2017 à 15:50, Sandro Santilli
      a écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:20171123145008.4cgkbo53xs5mbeck@liz">
      <pre wrap="">Are you using the C or C++ API ?
When using the C API you can define
the GEOS_USE_ONLY_R_API macro to be
sure to be only using thread-safe methods.

If you find a non-reentrant path by using that
API then please file a bug report including
the smallest testcase.

--strk;
</pre>
    </blockquote>
  </body>
</html>