-
Notifications
You must be signed in to change notification settings - Fork 862
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
Can _node->is_leader()
be used?
#208
Comments
I'm guessing the big difference be that Node::is_leader() try to acquire a bthread_mutex_t before reading the |_state|, while the fsm(example::Counter) just use an atomic load |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The examples use a
_leader_term
variable to check if the current node is a leader:https://github.com/baidu/braft/blob/master/example/counter/server.cpp#L153
Instead, can one use
_node->is_leader()
?https://github.com/baidu/braft/blob/master/src/braft/raft.h#L619
What's the difference between these 2 different approaches?
The text was updated successfully, but these errors were encountered: