I'm starting to use
RWMutex in my Go project with
map since now I have more than one routine running at the same time and while making all of the changes for that a doubt came to my mind.
The thing is that I know that we must use
RLock when only reading to allow other routines to do the same task and
Lock when writing to full-block the map. But what are we supposed to do when editing a previously created element in the map?
For example... Let's say I have a
map[int]string where I do
Lock, put inside
"hello " and then
Unlock. What if I want to add
"world" to it? Should I do
Lock or can I do