Skip to content

Commit

Permalink
fix: fix atomic ordering in multi-thread
Browse files Browse the repository at this point in the history
  • Loading branch information
driftluo committed Aug 29, 2024
1 parent 50b74a2 commit 1a31768
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tx-pool/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ macro_rules! send_notify {
impl TxPoolController {
/// Return whether tx-pool service is started
pub fn service_started(&self) -> bool {
self.started.load(Ordering::Relaxed)
self.started.load(Ordering::Acquire)
}

/// Set tx-pool service started, should only used for test
#[cfg(feature = "internal")]
pub fn set_service_started(&self, v: bool) {
self.started.store(v, Ordering::Relaxed);
self.started.store(v, Ordering::Release);
}

/// Return reference of tokio runtime handle
Expand Down Expand Up @@ -658,7 +658,7 @@ impl TxPoolServiceBuilder {
}
}
});
self.started.store(true, Ordering::Relaxed);
self.started.store(true, Ordering::Release);
if let Err(err) = self.tx_pool_controller.load_persisted_data(txs) {
error!("Failed to import persistent txs, cause: {}", err);
}
Expand Down

0 comments on commit 1a31768

Please sign in to comment.