About Store Forum Documentation Contact



Post Reply 
What does lock()/unlock() do?
Author Message
SamNainocard Offline
Member

Post: #1
What does lock()/unlock() do?
Sorry for such a stupid question smile, I always found these method around at draw function but not anywhere else, so what does lock/unlock from Map<> and Image do? Because I can still access lockedData/Key without locking it first.
06-24-2015 07:16 AM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #2
RE: What does lock()/unlock() do?
It locks/unlocks the memory for other threads. smile
06-24-2015 08:30 AM
Find all posts by this user Quote this message in a reply
georgatos7 Offline
Member

Post: #3
RE: What does lock()/unlock() do?
Nice, thanks for the explanation.
(This post was last modified: 06-24-2015 10:20 PM by georgatos7.)
06-24-2015 08:38 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: What does lock()/unlock() do?
If you lock a Map on one thread, then other threads won't be able to add/remove elements. This is for multi-threading.

Images needs to be locked in order to access their pixels (except software mode which always has full access).
06-24-2015 10:59 PM
Find all posts by this user Quote this message in a reply
Post Reply