These register and get functions have their own design principles:
register is only called serially during initialization. Once initialization is complete, register will not be called again.
get can be called concurrently in various rpcs after initialization. Since there is no concurrent writing by register afterwards, there are no concurrent read-write issues.
Apart from the selector/servicerouter, you can also look at plugins like log. The maps operated by their register functions do not have locks.
I suggest that you could help by adding comments here to explain the correct semantics and usage of register/get, rather than adding more locks.
These register and get functions have their own design principles:
Apart from the selector/servicerouter, you can also look at plugins like log. The maps operated by their register functions do not have locks.
I suggest that you could help by adding comments here to explain the correct semantics and usage of register/get, rather than adding more locks.