PIL threading problems

Christian Heimes lists at cheimes.de
Wed May 30 05:05:32 EDT 2012


Am 30.05.2012 05:09, schrieb Paul Rubin:
> Kind of a long shot, but are there known problems in calling PIL from
> multiple threads?  I'm getting weird intermittent core dumps from my
> app, no idea what's causing them, but PIL is the only C module I'm
> using, and I do see some mention on the interwebs that there might
> be an issue:
> 
>   http://lists.tiker.net/pipermail/pycuda/2009-March/001393.html
> 
> Any suggestions?  Would it be enough to put a lock around the PIL
> calls that I use?

In my experience PIL works just fine with threading. We used to process
terabytes of TIFF images in a multithreaded application until we
switched to FreeImage.

You should make sure that you don't access a PILs object from more than
one thread. We have treated PIL as reentrant but not thread-safe.

Christian




More information about the Python-list mailing list