Please help with Threading

Dave Angel davea at davea.name
Mon May 20 07:06:04 EDT 2013


On 05/20/2013 03:55 AM, Fábio Santos wrote:
> My use case was a tight loop processing an image pixel by pixel, or
> crunching a CSV file. If it only uses local variables (and probably hold a
> lock before releasing the GIL) it should be safe, no?
>

Are you making function calls, using system libraries, or creating or 
deleting any objects?  All of these use the GIL because they use common 
data structures shared among all threads.  At the lowest level, creating 
an object requires locked access to the memory manager.


Don't forget, the GIL gets used much more for Python internals than it 
does for the visible stuff.


-- 
DaveA



More information about the Python-list mailing list