To ensure a map is safe to use concurrently from multiple goroutines, you would typically use a _____.

  • mutex
  • semaphore
  • channel
  • pointer
To ensure a map is safe to use concurrently from multiple goroutines in Go, you would typically use a mutex (mutual exclusion). A mutex helps synchronize access to the map, preventing data races and ensuring that only one goroutine can modify the map at a time. The correct option is (1) mutex.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *