[Community] Shapely thread-safety?
sgillies at frii.com
Tue Apr 1 21:21:29 EEST 2008
Sean Gillies wrote:
> Allen Bierbaum wrote:
>> Is shapely thread-safe? I ask because my application is seg faulting
>> inside geos when I try to use shapely from multiple threads. At first
>> it was hard to reproduce, but I was finally able to write a
>> reproducible test case that fails every time I run it (see attached).
>> Can anyone shed some light on this?
> Shapely's WK* reading and writing uses GEOS C functions which use some
> global objects. I've assumed that ctypes function calls don't release
> the GIL, protecting us from GEOS threading problems, but maybe that has
> been a bad assumption.
> Grep for "GIL". Yes, it has been a bad assumption. I don't know how I
> overlooked that :( Are you interested in trying PyDLL instead of CDLL?
> Or locks around the WK* reading and writing?
This section of the ctypes docs looks helpful:
More information about the Community