Example:
image = Image.open('foo.png')
# releases the GIL?
resized = image.resize((800, 600), Image.ANTIALIAS)
# reacquires the GIL?
Obviously the variable assignment needs to hold the GIL, but it's difficult to break that up into two lines. :)
If there are two threads doing image resizes, can those resizes run on two different cores?
Looking at the source of 1.1.7, it doesn't appear to release the GIL for _resize
.
The functions that release the GIL seem to be:
PyImaging_CreateWindowWin32 (createwindow on Win32)
PyImaging_EventLoopWin32 (eventloop on Win32)
pyCMSdoTransform (apply)
_buildTransform (buildTransform)
_buildProofTransform (buildProofTransform)
_encode_to_file (encode_to_file)