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

Use channels and non-blocking Wait to fix a potential race. #15

Merged
merged 1 commit into from
Dec 31, 2014

Conversation

eaburns
Copy link
Owner

@eaburns eaburns commented Dec 31, 2014

The race will never happen in practice, but whatever. I like this.

Fixes #14.

The race will never happen in practice, but whatever. I like this.

Fixes #14.
@eaburns
Copy link
Owner Author

eaburns commented Dec 31, 2014

Want to try it on OSX before merging it?
I am curious if the syscall barf is the same and if it even compiles.

}
n++

case <-tick:
Copy link
Owner Author

Choose a reason for hiding this comment

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

I used a ticker because the busy loop bothered me. Does this actually matter? The syscall is going to move the Go routine and park it on a new thread. That probably takes longer than the ticker in the first place, right?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Also, 5ms is pretty quick. Should I make it longer if we decide to keep it?

@mccoyst
Copy link
Collaborator

mccoyst commented Dec 31, 2014

We'll see how it goes.

mccoyst added a commit that referenced this pull request Dec 31, 2014
Use channels and non-blocking Wait to fix a potential race.
@mccoyst mccoyst merged commit 5087ce7 into master Dec 31, 2014
@eaburns eaburns deleted the fix_race branch February 27, 2015 21:40
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.

Fix clumsy race in run/kill
2 participants