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

Add lock #490

Merged
merged 2 commits into from
Sep 26, 2016
Merged

Add lock #490

merged 2 commits into from
Sep 26, 2016

Conversation

yvxiang
Copy link
Collaborator

@yvxiang yvxiang commented Sep 25, 2016

这个一秒一次,不知道会不会有点费

recover_speed += cs->recover_speed();
if (cs->load() > kChunkServerLoadMax) {
++overload;
}
}
}
stats_.w_qps = w_qps;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这里有必要锁么?读的时候是没加锁的,整数读/写也应该是原子的,最多导致读出来的stats_结构里多个数据间不一致

Copy link
Collaborator

Choose a reason for hiding this comment

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

是啊。。有必要加锁么?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

上面有必要,下面感觉可以不加

@bluebore bluebore merged commit 0a3e968 into baidu:master Sep 26, 2016
@yvxiang yvxiang deleted the lock branch September 26, 2016 03:12
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.

3 participants