소스 검색

Minor refactor: set keep_running to true at creation.

Jing Yang 3 년 전
부모
커밋
26321803c4
1개의 변경된 파일1개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 2
      src/raft.rs

+ 1 - 2
src/raft.rs

@@ -112,7 +112,7 @@ impl<Command: ReplicableCommand> Raft<Command> {
             persister,
             new_log_entry: None,
             apply_command_signal: Default::default(),
-            keep_running: Default::default(),
+            keep_running: Arc::new(AtomicBool::new(true)),
             election: Arc::new(election),
             snapshot_daemon: SnapshotDaemon::create(),
             verify_authority_daemon: VerifyAuthorityDaemon::create(peer_size),
@@ -122,7 +122,6 @@ impl<Command: ReplicableCommand> Raft<Command> {
             stop_wait_group: WaitGroup::new(),
         };
 
-        this.keep_running.store(true, Ordering::SeqCst);
         // Running in a standalone thread.
         this.run_verify_authority_daemon();
         // Running in a standalone thread.