Map with concurrent access

When you use a map in a program with concurrent access, is there any need to use a mutex in functions to read values?

1 Like

Multiple readers, no writers is okay:

One writer, no readers is okay. (Maps wouldn’t be much good otherwise.)

Otherwise, if there is at least one writer and at least one more either writer or reader, then all readers and writers must use synchronization to access the map. A mutex works fine for this.