Skip to content
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

change atomic.Value to atomic.Pointer #2088

Merged
merged 1 commit into from
Feb 14, 2023

Conversation

sukunrt
Copy link
Member

@sukunrt sukunrt commented Feb 13, 2023

fixes: #2056

Comment on lines +167 to +168
nn := now
d.lastTick.Store(&nn)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not &now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now is declared outside the block and reassigned at line 219. storing a pointer to now would cause it to use this value of 219 sometimes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@marten-seemann marten-seemann changed the title go 1.19: change atomic.Value to atomic.Pointer change atomic.Value to atomic.Pointer Feb 14, 2023
@marten-seemann marten-seemann merged commit 3d9cc01 into libp2p:master Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Go 1.19: use atomic.Pointer instead of atomic.Value
2 participants