B
bonk
Does anyone have a simple example on how to prohibit that any thread
other than the current thread modifies a certain object (a collection)
while we are in a certain section of the code?
In other words: while we are inside this codeblock whoever might think
of modified that particular collection has to wait until we have left
that codeblock.
As far as I understand it lock() {} only prohibits that other threads
enter a certain block of code while the current thread is inside of it
but does not prohibit modification of the object that was passed as the
parameter for lock() ...
other than the current thread modifies a certain object (a collection)
while we are in a certain section of the code?
In other words: while we are inside this codeblock whoever might think
of modified that particular collection has to wait until we have left
that codeblock.
As far as I understand it lock() {} only prohibits that other threads
enter a certain block of code while the current thread is inside of it
but does not prohibit modification of the object that was passed as the
parameter for lock() ...