Refactor: Replace async Mutex for RaftInner.core_state with standard Mutex and a watch channel
In this commit, when joining the RaftCore task, the core_state is
first switched from Running to Joining. The thread then blocks
while awaiting the completion of the RaftCore task. Any other threads
observing the Joining state will wait for the first thread to finish
by monitoring a watch channel created by the initial thread.
Refactor: RaftInner::tx_shutdown changed to use std Mutex
RaftInner::tx_shutdown has been changed to use a standard
(synchronous) Mutex instead of an asynchronous one. This change is made
because tx_shutdown does not span across .await points, making the
asynchronous capabilities unnecessary.
Changelog
Refactor: Replace async Mutex for
RaftInner.core_state
with standard Mutex and a watch channelIn this commit, when joining the
RaftCore
task, thecore_state
is first switched fromRunning
toJoining
. The thread then blocks while awaiting the completion of theRaftCore
task. Any other threads observing theJoining
state will wait for the first thread to finish by monitoring awatch
channel created by the initial thread.Refactor:
RaftInner::tx_shutdown
changed to use std MutexRaftInner::tx_shutdown
has been changed to use a standard (synchronous) Mutex instead of an asynchronous one. This change is made becausetx_shutdown
does not span across.await
points, making the asynchronous capabilities unnecessary.This change is