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

message: atomic races #120

Merged
merged 1 commit into from
Feb 21, 2015
Merged

message: atomic races #120

merged 1 commit into from
Feb 21, 2015

Conversation

mreiferson
Copy link
Member

there was the possibility of a race since we were separately checking/storing

cc @schmichael

@mreiferson mreiferson added the bug label Feb 21, 2015
@mreiferson
Copy link
Member Author

RFR @jehiah

}

// Touch sends a TOUCH command to the nsqd which
// sent this message
func (m *Message) Touch() {
if m.HasResponded() {
if !atomic.CompareAndSwapInt32(&m.responded, 0, 1) {
Copy link
Member

Choose a reason for hiding this comment

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

just LoadInt32 here since we don't want Touch() to mark as responded.

Copy link
Member Author

Choose a reason for hiding this comment

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

ahh good catch

@mreiferson
Copy link
Member Author

fixed

jehiah added a commit that referenced this pull request Feb 21, 2015
@jehiah jehiah merged commit 75d97a3 into nsqio:master Feb 21, 2015
@mreiferson mreiferson deleted the races_120 branch February 21, 2015 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants