Skip to content
This repository was archived by the owner on May 18, 2023. It is now read-only.

Fix race condition on 'now' when creating a timer#58

Merged
benbjohnson merged 1 commit intobenbjohnson:masterfrom
mjte-riot:master
May 18, 2023
Merged

Fix race condition on 'now' when creating a timer#58
benbjohnson merged 1 commit intobenbjohnson:masterfrom
mjte-riot:master

Conversation

@mjte-riot
Copy link
Copy Markdown
Contributor

This is a proposed solution to issue #57

The proposed solution is to capture m.now within the lock and use it subsequently after the lock is released. The added test case is somewhat fabricated in order to reproduce the issue initially using go test ./... -race -count=1.

Copy link
Copy Markdown
Collaborator

@djmitche djmitche left a comment

Choose a reason for hiding this comment

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

This looks like a good fix. I thought I ran through this file and checked that all m.* access was done with m.mu held, but I guess I missed at least two places. If only the compiler could do this for us [cough]!

@benbjohnson I see you made a release recently. I don't use Go day-to-day anymore, so I'm no longer a user of this library. Would you like to resume maintenance of this library?

@benbjohnson
Copy link
Copy Markdown
Owner

I'll go ahead and merge this and the other PR and cut a release. I haven't used this library for a long time so I'll probably archive it and someone can fork it if they're interested.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants