[Community] Shapely thread-safety?
Sean Gillies
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?
>>
>> Thanks,
>> Allen
>>
>
> Allen,
>
> 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.
>
> http://starship.python.net/crew/theller/ctypes/reference.html
>
> 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?
>
> Sean
This section of the ctypes docs looks helpful:
http://starship.python.net/crew/theller/ctypes/reference.html#id4
Sean
More information about the Community
mailing list