-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enhancement/read-only-on-get #18
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, that is exactly what I meant! 👍
state.go
Outdated
s.RLock() | ||
defer s.RUnlock() | ||
|
||
if _, ok := s.state[group][id][sender]; !ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, then you theoreticaly can even do
state, _ := s.state[group][id][sender]
return state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would state not be nil @mandrigin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it it is not a pointer, it shoudn't be it will be a default value of the struct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mandrigin running this code seems to run into a deadlock at one point, need to investigate further. |
It’s unlikely there, this code is pretty straightforward, but if you call Get or Set inside Map, that might bring trouble. |
No description provided.