I've read a little about surface locking and unlocking in pygame in Beginning Game Development with Python and Pygame. However, I still don't understand it.
I've read that it can improve the game performance, so I'm wondering about its other advantages.
So overall, what are the main uses of surface locking and unlocking ?
How does it improve performance ?
Is it necessary to lock and unlock the screen everytime I blit an image into it ?
Here is a part of the passage that I read in that book :
Whenever Pygame draws onto a surface, it first has to be locked. When a surface is locked, Pygame has full control over the surface and no other process on the computer can use it until it is unlocked. Locking and unlocking happens automatically whenever you draw onto a surface, but it can become inefficient if Pygame has too many locks and unlocks.
I'm mostly wondering about manual locks and unlocks and not just about automatic ones and btw to lock and unlock a surface manually, all is needed is :
surface.lock() # applying some changes to that surface surface.unlock()