SamNainocard
Member
|
What does lock()/unlock() do?
Sorry for such a stupid question , 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 |
|
Tottel
Member
|
RE: What does lock()/unlock() do?
It locks/unlocks the memory for other threads.
|
|
06-24-2015 08:30 AM |
|
georgatos7
Member
|
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 |
|
Esenthel
Administrator
|
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 |
|